Method: Representable::Declarative#nested
- Defined in:
- lib/representable/declarative.rb
#nested(name, options = {}, &block) ⇒ Object
Allows you to nest a block of properties in a separate section while still mapping them to the original object.
22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/representable/declarative.rb', line 22 def nested(name, ={}, &block) = .merge( getter: ->() { self }, setter: ->() { }, instance: ->() { self }, ) if block [:_nested_builder] = Decorator.nested_builder [:_base] = Decorator.default_nested_class end property(name, , &block) end |