Class: ErrorBuilder::Formats::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/error_builder/formats/base.rb

Direct Known Subclasses

Array, Hash

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(errors, flat: false) ⇒ Base

Returns a new instance of Base.



8
9
10
11
# File 'lib/error_builder/formats/base.rb', line 8

def initialize(errors, flat: false)
  @errors = errors
  @flat   = flat
end

Instance Attribute Details

#errorsObject (readonly)

Returns the value of attribute errors.



6
7
8
# File 'lib/error_builder/formats/base.rb', line 6

def errors
  @errors
end

#flatObject (readonly)

Returns the value of attribute flat.



6
7
8
# File 'lib/error_builder/formats/base.rb', line 6

def flat
  @flat
end

Instance Method Details

#to_hObject

Raises:

  • (NotImplementedError)


13
14
15
# File 'lib/error_builder/formats/base.rb', line 13

def to_h
  raise NotImplementedError, "#{self.class} has not implemented method '#{__method__}'"
end