Exception: Lore::Exceptions::Invalid_Field

Inherits:
Exception
  • Object
show all
Defined in:
lib/lore/exceptions/invalid_field.rb

Direct Known Subclasses

Invalid_Types, Unmet_Constraints

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(invalid_params) ⇒ Invalid_Field

Returns a new instance of Invalid_Field.



9
10
11
12
# File 'lib/lore/exceptions/invalid_field.rb', line 9

def initialize(invalid_params) 
  @invalid_params = invalid_params
  @reason = :invalid
end

Instance Attribute Details

#invalid_paramsObject (readonly) Also known as: fields

Returns the value of attribute invalid_params.



7
8
9
# File 'lib/lore/exceptions/invalid_field.rb', line 7

def invalid_params
  @invalid_params
end

#reasonObject (readonly)

Returns the value of attribute reason.



7
8
9
# File 'lib/lore/exceptions/invalid_field.rb', line 7

def reason
  @reason
end

Instance Method Details

#inspectObject



22
23
24
# File 'lib/lore/exceptions/invalid_field.rb', line 22

def inspect
  serialize.inspect
end

#serializeObject



15
16
17
18
19
20
21
# File 'lib/lore/exceptions/invalid_field.rb', line 15

def serialize
  result = {}
  @invalid_params.each_pair { |field, type| 
    result[field] = type 
  }
  result
end