lib/representable/json/hash.rb in representable-1.2.1 vs lib/representable/json/hash.rb in representable-1.2.2

- old
+ new

@@ -1,8 +1,11 @@ +require 'representable/hash_methods' + module Representable::JSON module Hash include Representable::JSON + include HashMethods def self.included(base) base.class_eval do include Representable extend ClassMethods @@ -15,24 +18,10 @@ hash :_self, options end end - def create_representation_with(doc, options, format) - bin = representable_bindings_for(format).first - bin.serialize_for(self) - end - - def update_properties_from(doc, options, format) - bin = representable_bindings_for(format).first - value = bin.deserialize_from(doc) - replace(value) - end - - # FIXME: refactor Definition so we can simply add options in #items to existing definition. - def representable_attrs - attrs = super - attrs << Definition.new(:_self, :hash => true) if attrs.size == 0 - attrs + def definition_opts + [:_self, :hash => true, :use_attributes => true] end end end