Module: Disposable::Twin::Property::Struct
- Defined in:
- lib/disposable/twin/property/struct.rb
Overview
Instance Method Summary collapse
- #read_value_for(dfn, options) ⇒ Object
-
#save! ⇒ Object
So far, hashes can’t be persisted separately.
- #sync(options = {}) ⇒ Object (also: #sync!)
-
#sync_hash_representer ⇒ Object
TODO: make this without representable, please.
Instance Method Details
#read_value_for(dfn, options) ⇒ Object
7 8 9 10 |
# File 'lib/disposable/twin/property/struct.rb', line 7 def read_value_for(dfn, ) name = dfn[:name] @model[name.to_s] || @model[name.to_sym] # TODO: test sym vs. str. end |
#save! ⇒ Object
So far, hashes can’t be persisted separately.
28 29 |
# File 'lib/disposable/twin/property/struct.rb', line 28 def save! end |
#sync(options = {}) ⇒ Object Also known as: sync!
22 23 24 |
# File 'lib/disposable/twin/property/struct.rb', line 22 def sync(={}) sync_hash_representer.new(self).to_hash end |
#sync_hash_representer ⇒ Object
TODO: make this without representable, please.
12 13 14 15 16 17 18 19 20 |
# File 'lib/disposable/twin/property/struct.rb', line 12 def sync_hash_representer # TODO: make this without representable, please. Sync.hash_representer(self.class) do |dfn| dfn.merge!( prepare: lambda { || [:input] }, serialize: lambda { || [:input].sync! }, representable: true ) if dfn[:nested] end end |