Sha256: 3630d2a29ff0d4eee45fed207cae8df45d4afd93e95a3d904b09d3065ab8b7de

Contents?: true

Size: 353 Bytes

Versions: 1

Compression:

Stored size: 353 Bytes

Contents

require "mighty_struct"
require_relative "../alma_api"

class AlmaApi::Object < MightyStruct
  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
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
alma_api-0.1.0 lib/alma_api/object.rb