Module: JSONAPI::Ruby::Deserializer::Parser

Included in:
Attributes, Errors, Jsonapi, Links, Meta, Relationships, Resource
Defined in:
lib/jsonapi-ruby-deserializer/parser.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#to_hObject

Returns the value of attribute to_h.



7
8
9
# File 'lib/jsonapi-ruby-deserializer/parser.rb', line 7

def to_h
  @to_h
end

Instance Method Details

#parse!(data) ⇒ Object



9
10
11
12
13
14
15
# File 'lib/jsonapi-ruby-deserializer/parser.rb', line 9

def parse!(data)
  @to_h = data
  data.each do |field, value|
    instance_variable_set("@#{field}", value)
    self.class.send(:attr_accessor, field.to_sym)
  end
end