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.
10 11 12 |
# File 'lib/cucumber/formatter/fanout.rb', line 10 def initialize(recipients) @recipients = recipients end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(message, *args) ⇒ Object
14 15 16 17 18 |
# File 'lib/cucumber/formatter/fanout.rb', line 14 def method_missing(, *args) recipients.each do |recipient| recipient.send(, *args) if recipient.respond_to?() end end |
Instance Method Details
#respond_to_missing?(name, include_private = false) ⇒ Boolean
20 21 22 |
# File 'lib/cucumber/formatter/fanout.rb', line 20 def respond_to_missing?(name, include_private = false) recipients.any? { |recipient| recipient.respond_to?(name, include_private) } end |