Module: Attributary::Serializer::InstanceMethods

Defined in:
lib/attributary/serializer.rb

Instance Method Summary collapse

Instance Method Details

#as_jsonObject



12
13
14
15
16
17
18
# File 'lib/attributary/serializer.rb', line 12

def as_json
  hash = {}
  self.class._attributary_attribute_set.keys.each do |key|
    hash[key] = read_attribute_for_serialization(key)
  end
  hash
end

#read_attribute_for_serialization(attribute_name) ⇒ Object



8
9
10
# File 'lib/attributary/serializer.rb', line 8

def read_attribute_for_serialization(attribute_name)
  send(attribute_name)
end