Class: Approvals::Reporters::FirstWorkingReporter

Inherits:
Object
  • Object
show all
Defined in:
lib/approvals/reporters/first_working_reporter.rb

Direct Known Subclasses

ImageReporter

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(*reporters) ⇒ FirstWorkingReporter


6
7
8
# File 'lib/approvals/reporters/first_working_reporter.rb', line 6

def initialize(*reporters)
  self.reporters = reporters
end

Instance Attribute Details

#reportersObject

Returns the value of attribute reporters


5
6
7
# File 'lib/approvals/reporters/first_working_reporter.rb', line 5

def reporters
  @reporters
end

Instance Method Details

#report(received, approved) ⇒ Object


14
15
16
17
# File 'lib/approvals/reporters/first_working_reporter.rb', line 14

def report(received, approved)
  reporter = reporters.find(&:working_in_this_environment?)
  reporter.report(received, approved) unless reporter.nil?
end

#working_in_this_environment?Boolean


10
11
12
# File 'lib/approvals/reporters/first_working_reporter.rb', line 10

def working_in_this_environment?
  reporters.any?(&:working_in_this_environment?)
end