Sha256: 38689a7060c28ab5538a5c54cc950027577964d1532c7c8e98360772af838332
Contents?: true
Size: 907 Bytes
Versions: 1
Compression:
Stored size: 907 Bytes
Contents
module Representable class Binding attr_reader :definition # TODO: merge Binding and Definition. def initialize(definition) @definition = definition end # Main entry point for rendering/parsing a property object. module Hooks def serialize(value) value end def deserialize(fragment) fragment end end include Hooks # Hooks into #serialize and #deserialize to extend typed properties # at runtime. module Extend # Extends the object with its representer before serialization. def serialize(object) extend_for(super) end def deserialize(*) extend_for(super) end def extend_for(object) if mod = definition.representer_module object.extend(*mod) end object end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
representable-1.2.0 | lib/representable/binding.rb |