Sha256: 7e1788cd2d5497389745081831f4b55f63f83545cb4737ad6991215cf7c6b882
Contents?: true
Size: 910 Bytes
Versions: 1
Compression:
Stored size: 910 Bytes
Contents
require 'representable/binding' module Representable module Hash class Binding < Representable::Binding def self.build_for(definition, *args) # TODO: remove default arg. # puts "@@@build@@ #{definition.inspect}" return Collection.new(definition, *args) if definition.array? return Hash.new(definition, *args) if definition.hash? new(definition, *args) end def read(hash) return FragmentNotFound unless hash.has_key?(as) hash[as] # fragment end def write(hash, fragment) hash[as] = fragment end def serialize_method :to_hash end def deserialize_method :from_hash end class Collection < self include Representable::Binding::Collection end class Hash < self include Representable::Binding::Hash end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
representable-2.3.0 | lib/representable/hash/binding.rb |