Module: Representable::Binding::Object

Included in:
Hash::PropertyBinding, XML::PropertyBinding
Defined in:
lib/representable/binding.rb

Overview

Delegates to call #to_/from_.

Instance Method Summary collapse

Instance Method Details

#create_object(fragment) ⇒ Object



120
121
122
# File 'lib/representable/binding.rb', line 120

def create_object(fragment)
  instance_for(fragment) or class_for(fragment)
end

#deserialize(data, object = lambda { get }) ⇒ Object



115
116
117
118
# File 'lib/representable/binding.rb', line 115

def deserialize(data, object=lambda { get })
  # DISCUSS: does it make sense to skip deserialization of nil-values here?
  ObjectDeserializer.new(self, object).call(data)
end

#serialize(object) ⇒ Object



111
112
113
# File 'lib/representable/binding.rb', line 111

def serialize(object)
  ObjectSerializer.new(self, object).call
end