Class: Reporter

Inherits:
Object
  • Object
show all
Defined in:
lib/hiptest-publisher/formatters/reporter.rb

Instance Method Summary collapse

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, message = nil)
  notify(:dump_error, error, message)
end

#notify(message, *args) ⇒ Object



20
21
22
23
24
25
# File 'lib/hiptest-publisher/formatters/reporter.rb', line 20

def notify(message, *args)
  @listeners.each do |listener|
    listener.send(message, *args)
  end
  nil
end

#show_options(options, message = nil) ⇒ Object



16
17
18
# File 'lib/hiptest-publisher/formatters/reporter.rb', line 16

def show_options(options, message = nil)
  notify(:show_options, options, message)
end