Class: Cucumber::Formatter::Fanout

Inherits:
BasicObject
Defined in:
lib/cucumber/formatter/fanout.rb

Overview

Forwards any messages sent to this object to all recipients that respond to that message.

Instance Method Summary collapse

Constructor Details

#initialize(recipients) ⇒ Fanout

Returns a new instance of Fanout


11
12
13
# File 'lib/cucumber/formatter/fanout.rb', line 11

def initialize(recipients)
  @recipients = recipients
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(message, *args) ⇒ Object


15
16
17
18
19
# File 'lib/cucumber/formatter/fanout.rb', line 15

def method_missing(message, *args)
  recipients.each do |recipient|
    recipient.send(message, *args) if recipient.respond_to?(message)
  end
end

Instance Method Details

#respond_to_missing?(name, include_private = false) ⇒ Boolean

Returns:

  • (Boolean)

21
22
23
# File 'lib/cucumber/formatter/fanout.rb', line 21

def respond_to_missing?(name, include_private = false)
  recipients.any? { |recipient| recipient.respond_to?(name, include_private) }
end