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
-
#initialize(recipients) ⇒ Fanout
constructor
A new instance of Fanout.
- #method_missing(message, *args) ⇒ Object
- #respond_to_missing?(name, include_private = false) ⇒ Boolean
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 20 21 |
# File 'lib/cucumber/formatter/fanout.rb', line 15 def method_missing(, *args) super unless recipients recipients.each do |recipient| recipient.send(, *args) if recipient.respond_to?() end end |
Instance Method Details
#respond_to_missing?(name, include_private = false) ⇒ Boolean
23 24 25 |
# File 'lib/cucumber/formatter/fanout.rb', line 23 def respond_to_missing?(name, include_private = false) recipients.any? { |recipient| recipient.respond_to?(name, include_private) } || super(name, include_private) end |