Class: Cucumber::Broadcaster
- Defined in:
- lib/gems/cucumber-0.1.15/lib/cucumber/broadcaster.rb
Instance Method Summary collapse
-
#initialize(receivers = []) ⇒ Broadcaster
constructor
A new instance of Broadcaster.
- #method_missing(method_name, *args) ⇒ Object
- #register(receiver) ⇒ Object
Constructor Details
#initialize(receivers = []) ⇒ Broadcaster
Returns a new instance of Broadcaster.
4 5 6 |
# File 'lib/gems/cucumber-0.1.15/lib/cucumber/broadcaster.rb', line 4 def initialize(receivers = []) @receivers = receivers end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method_name, *args) ⇒ Object
12 13 14 15 16 17 |
# File 'lib/gems/cucumber-0.1.15/lib/cucumber/broadcaster.rb', line 12 def method_missing(method_name, *args) @receivers.each do |receiver| r = (receiver == STDOUT) ? Kernel : receiver # Needed to make colors work on Windows r.__send__(method_name, *args) if receiver.respond_to?(method_name) end end |
Instance Method Details
#register(receiver) ⇒ Object
8 9 10 |
# File 'lib/gems/cucumber-0.1.15/lib/cucumber/broadcaster.rb', line 8 def register(receiver) @receivers << receiver end |