Class: Reporter
- Inherits:
-
Object
- Object
- Reporter
- Defined in:
- lib/hiptest-publisher/formatters/reporter.rb
Instance Method Summary collapse
- #add_listener(listener) ⇒ Object
- #dump_error(error, message = nil) ⇒ Object
-
#initialize(listeners = nil) ⇒ Reporter
constructor
A new instance of Reporter.
- #notify(message, *args) ⇒ Object
- #show_options(options, message = nil) ⇒ Object
Constructor Details
#initialize(listeners = nil) ⇒ Reporter
Returns a new instance of Reporter.
4 5 6 |
# File 'lib/hiptest-publisher/formatters/reporter.rb', line 4 def initialize(listeners = nil) @listeners = listeners || [] end |
Instance Method Details
#add_listener(listener) ⇒ Object
8 9 10 |
# File 'lib/hiptest-publisher/formatters/reporter.rb', line 8 def add_listener(listener) @listeners << listener end |
#dump_error(error, message = nil) ⇒ Object
12 13 14 |
# File 'lib/hiptest-publisher/formatters/reporter.rb', line 12 def dump_error(error, = nil) notify(:dump_error, error, ) end |
#notify(message, *args) ⇒ Object
20 21 22 23 24 25 |
# File 'lib/hiptest-publisher/formatters/reporter.rb', line 20 def notify(, *args) @listeners.each do |listener| listener.send(, *args) end nil end |
#show_options(options, message = nil) ⇒ Object
16 17 18 |
# File 'lib/hiptest-publisher/formatters/reporter.rb', line 16 def (, = nil) notify(:show_options, , ) end |