Class: AlmaApi::Object

Inherits:
MightyStruct
  • Object
show all
Defined in:
lib/alma_api/object.rb

Instance Method Summary collapse

Constructor Details

#initialize(object) ⇒ Object

Returns a new instance of Object.



5
6
7
8
9
10
11
12
13
14
15
# File 'lib/alma_api/object.rb', line 5

def initialize(object)
  if object.is_a?(Hash)
    object.each do |_key, _value|
      if _value.is_a?(String) && _value[/\A\d\d\d\d-\d\d-\d\d\w.*/]
        object[_key] = Date.parse(_value)
      end
    end
  end

  super(object)
end