Class List Method List File List

# Class: VertxUnit::EventBusCollector

Inherits:
  Object
  - Object
  - VertxUnit::EventBusCollector
  show all
Defined in:
  /Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-unit/event_bus_collector.rb

## Overview

The event bus collector listen to events on the Vert.x event bus and translate them into reports.

## Constant Summary

@@j_api_type =

      Object.new

## Class Method Summary (collapse)

- + (Boolean) accept?(obj)
- + (::VertxUnit::EventBusCollector) create(vertx = nil, reporter = nil) { ... }
- + (Object) j_api_type
- + (Object) j_class
- + (Object) unwrap(obj)
- + (Object) wrap(obj)

## Instance Method Summary (collapse)

- - (::Vertx::MessageConsumer) register(address = nil)
  Register the collector as a consumer of the event bus with the specified address.

## Class Method Details

### + (`Boolean`) accept?(obj)

Returns:

- (`Boolean`)

    21
    22
    23
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-unit/event_bus_collector.rb', line 21

    def @@j_api_type.accept?(obj)
      obj.class == EventBusCollector
    end

### + (`::VertxUnit::EventBusCollector`) create(vertx = nil, reporter = nil) { ... }

Parameters:

- vertx (`::Vertx::Vertx`) (defaults to: `nil`)

Yields:

Returns:

- (`::VertxUnit::EventBusCollector`)

Raises:

- (`ArgumentError`)

    39
    40
    41
    42
    43
    44
    45
    46
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-unit/event_bus_collector.rb', line 39

    def self.create(vertx=nil,reporter=nil)
      if vertx.class.method_defined?(:j_del) && reporter.class == Hash && !block_given?
        return ::Vertx::Util::Utils.safe_create(Java::IoVertxExtUnitCollect::EventBusCollector.java_method(:create, [Java::IoVertxCore::Vertx.java_class,Java::IoVertxExtUnitReport::ReportingOptions.java_class]).call(vertx.j_del,Java::IoVertxExtUnitReport::ReportingOptions.new(::Vertx::Util::Utils.to_json_object(reporter))),::VertxUnit::EventBusCollector)
      elsif vertx.class.method_defined?(:j_del) && block_given? && reporter == nil
        return ::Vertx::Util::Utils.safe_create(Java::IoVertxExtUnitCollect::EventBusCollector.java_method(:create, [Java::IoVertxCore::Vertx.java_class,Java::IoVertxCore::Handler.java_class]).call(vertx.j_del,(Proc.new { |event| yield(::Vertx::Util::Utils.safe_create(event,::VertxUnit::TestSuiteReport)) })),::VertxUnit::EventBusCollector)
      end
      raise ArgumentError, "Invalid arguments when calling create(#{vertx},#{reporter})"
    end

### + (`Object`) j_api_type

    30
    31
    32
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-unit/event_bus_collector.rb', line 30

    def self.j_api_type
      @@j_api_type
    end

### + (`Object`) j_class

    33
    34
    35
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-unit/event_bus_collector.rb', line 33

    def self.j_class
      Java::IoVertxExtUnitCollect::EventBusCollector.java_class
    end

### + (`Object`) unwrap(obj)

    27
    28
    29
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-unit/event_bus_collector.rb', line 27

    def @@j_api_type.unwrap(obj)
      obj.j_del
    end

### + (`Object`) wrap(obj)

    24
    25
    26
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-unit/event_bus_collector.rb', line 24

    def @@j_api_type.wrap(obj)
      EventBusCollector.new(obj)
    end

## Instance Method Details

### - (`::Vertx::MessageConsumer`) register(address = nil)

Register the collector as a consumer of the event bus with the specified address.

Parameters:

- address (`String`) (defaults to: `nil`) —
  the registration address

Returns:

- (`::Vertx::MessageConsumer`) —
  the subscribed message consumer

Raises:

- (`ArgumentError`)

    50
    51
    52
    53
    54
    55
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-unit/event_bus_collector.rb', line 50

    def register(address=nil)
      if address.class == String && !block_given?
        return ::Vertx::Util::Utils.safe_create(@j_del.java_method(:register, [Java::java.lang.String.java_class]).call(address),::Vertx::MessageConsumer)
      end
      raise ArgumentError, "Invalid arguments when calling register(#{address})"
    end