Class: SoberSwag::Reporting::Report::Object

Inherits:
Base
  • Object
show all
Defined in:
lib/sober_swag/reporting/report/object.rb

Overview

Report on problems with an object.

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#full_errors, #path_hash

Constructor Details

#initialize(problems) ⇒ Object

Returns a new instance of Object.

Parameters:

  • problems (Hash<Symbol, Report::Base>)

    the problems with each value.



9
10
11
# File 'lib/sober_swag/reporting/report/object.rb', line 9

def initialize(problems)
  @problems = problems
end

Instance Attribute Details

#problemsHash (readonly)

Returns the hash being reported on.

Returns:

  • (Hash)

    the hash being reported on



15
16
17
# File 'lib/sober_swag/reporting/report/object.rb', line 15

def problems
  @problems
end

Instance Method Details

#each_errorObject



17
18
19
20
21
22
23
24
25
# File 'lib/sober_swag/reporting/report/object.rb', line 17

def each_error
  return enum_for(:each_error) unless block_given?

  problems.each do |k, v|
    v.each_error do |nested, err|
      yield [".#{k}", nested].reject(&:nil?).join(''), err
    end
  end
end