Sha256: a5507065abf9f2bd6c8381552a4382a1d6734d267fa35bb62930c4c1b5a4d686
Contents?: true
Size: 777 Bytes
Versions: 4
Compression:
Stored size: 777 Bytes
Contents
module Disposable class Twin # Twin that uses a hash to populate. # # Twin.new(id: 1) module Struct def read_value_for(dfn, options) name = dfn[:name] @model[name.to_s] || @model[name.to_sym] # TODO: test sym vs. str. end def sync_hash_representer # TODO: make this without representable, please. Sync.hash_representer(self.class) do |dfn| dfn.merge!( prepare: lambda { |options| options[:input] }, serialize: lambda { |options| options[:input].sync! }, representable: true ) if dfn[:nested] end end def sync(options={}) sync_hash_representer.new(self).to_hash end alias_method :sync!, :sync end end end
Version data entries
4 entries across 4 versions & 1 rubygems