Class: SoberSwag::Reporting::Report::Value
- Defined in:
- lib/sober_swag/reporting/report/value.rb
Overview
Report for a single value. Basically a wrapper around an array of strings.
Instance Attribute Summary collapse
-
#problems ⇒ Array<String>
readonly
The problems the value had.
Instance Method Summary collapse
- #each_error ⇒ Object
-
#initialize(problems) ⇒ Value
constructor
A new instance of Value.
Methods inherited from Base
Constructor Details
#initialize(problems) ⇒ Value
Returns a new instance of Value.
10 11 12 13 14 |
# File 'lib/sober_swag/reporting/report/value.rb', line 10 def initialize(problems) raise ArgumentError, "#{problems} was not an enum" unless problems.respond_to?(:each) @problems = problems end |
Instance Attribute Details
#problems ⇒ Array<String> (readonly)
Returns the problems the value had.
18 19 20 |
# File 'lib/sober_swag/reporting/report/value.rb', line 18 def problems @problems end |
Instance Method Details
#each_error ⇒ Object
20 21 22 23 24 25 26 |
# File 'lib/sober_swag/reporting/report/value.rb', line 20 def each_error return enum_for(:each_error) unless block_given? problems.each do |problem| yield nil, problem end end |