Class: Approvals::Reporters::FirstWorkingReporter
- Inherits:
-
Object
- Object
- Approvals::Reporters::FirstWorkingReporter
- Defined in:
- lib/approvals/reporters/first_working_reporter.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#reporters ⇒ Object
Returns the value of attribute reporters.
Instance Method Summary collapse
-
#initialize(*reporters) ⇒ FirstWorkingReporter
constructor
A new instance of FirstWorkingReporter.
- #report(received, approved) ⇒ Object
- #working_in_this_environment? ⇒ Boolean
Constructor Details
#initialize(*reporters) ⇒ FirstWorkingReporter
Returns a new instance of FirstWorkingReporter.
6 7 8 |
# File 'lib/approvals/reporters/first_working_reporter.rb', line 6 def initialize(*reporters) self.reporters = reporters end |
Instance Attribute Details
#reporters ⇒ Object
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 |