Module: Disposable::Twin::Property::Unnest

Included in:
Disposable::Twin
Defined in:
lib/disposable/twin/property/unnest.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(includer) ⇒ Object

TODO: test that nested properties options are “unnested”, too, e.g. populator.



6
7
8
# File 'lib/disposable/twin/property/unnest.rb', line 6

def self.included(includer)
  includer.send(:include, Uber::Delegates)
end

Instance Method Details

#unnest(name, options) ⇒ Object



10
11
12
13
14
15
16
17
18
19
# File 'lib/disposable/twin/property/unnest.rb', line 10

def unnest(name, options)
  from = options.delete(:from)
  # needed to make reform process this field.

  options = definitions.get(from)[:nested].definitions.get(name).instance_variable_get(:@options) # FIXME.
  options = options.merge(virtual: true, _inherited: true, private_name: nil)

  property(name, options)
  delegates from, name, "#{name}="
end