module Representable::Hash::Collection
Public Class Methods
included(base)
click to toggle source
# File lib/representable/hash/collection.rb, line 5 def self.included(base) base.class_eval do include Representable::Hash extend ClassMethods representable_attrs.add(:_self, {:collection => true}) end end
Public Instance Methods
create_representation_with(doc, options, format)
click to toggle source
# File lib/representable/hash/collection.rb, line 21 def create_representation_with(doc, options, format) bin = representable_mapper(format, options).bindings(represented, options).first bin.render_fragment(represented, doc) end
update_properties_from(doc, options, format)
click to toggle source
# File lib/representable/hash/collection.rb, line 26 def update_properties_from(doc, options, format) bin = representable_mapper(format, options).bindings(represented, options).first #value = bin.deserialize_from(doc) value = Deserializer::Collection.new(bin).call(doc) represented.replace(value) end