Class: SoberSwag::Reporting::Report::Either
- Defined in:
- lib/sober_swag/reporting/report/either.rb
Overview
Models either one set of errors or another. Will enumerate them in order with #each_error
Instance Attribute Summary collapse
-
#lhs ⇒ Base
readonly
Left reports.
-
#rhs ⇒ Base
readonly
Right reports.
Instance Method Summary collapse
-
#each_error ⇒ Object
rubocop:disable Style/ExplicitBlockArgument.
-
#initialize(lhs, rhs) ⇒ Either
constructor
A new instance of Either.
Methods inherited from Base
Constructor Details
#initialize(lhs, rhs) ⇒ Either
Returns a new instance of Either.
8 9 10 11 |
# File 'lib/sober_swag/reporting/report/either.rb', line 8 def initialize(lhs, rhs) @lhs = lhs @rhs = rhs end |
Instance Attribute Details
#lhs ⇒ Base (readonly)
Returns left reports.
15 16 17 |
# File 'lib/sober_swag/reporting/report/either.rb', line 15 def lhs @lhs end |
#rhs ⇒ Base (readonly)
Returns right reports.
18 19 20 |
# File 'lib/sober_swag/reporting/report/either.rb', line 18 def rhs @rhs end |
Instance Method Details
#each_error ⇒ Object
rubocop:disable Style/ExplicitBlockArgument
21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/sober_swag/reporting/report/either.rb', line 21 def each_error return enum_for(:each_error) unless block_given? lhs.each_error do |key, value| yield key, value end rhs.each_error do |key, value| yield key, value end end |