Module: Representable::ClassMethods::Declarations
- Defined in:
- lib/representable.rb
Instance Method Summary collapse
- #collection(name, options = {}, &block) ⇒ Object
- #hash(name = nil, options = {}, &block) ⇒ Object
- #property(name, options = {}, &block) ⇒ Object
- #representable_attrs ⇒ Object
- #representation_wrap=(name) ⇒ Object
Instance Method Details
#collection(name, options = {}, &block) ⇒ Object
107 108 109 110 |
# File 'lib/representable.rb', line 107 def collection(name, ={}, &block) [:collection] = true # FIXME: don't override original. property(name, , &block) end |
#hash(name = nil, options = {}, &block) ⇒ Object
112 113 114 115 116 117 |
# File 'lib/representable.rb', line 112 def hash(name=nil, ={}, &block) return super() unless name # allow Object.hash. [:hash] = true property(name, , &block) end |
#property(name, options = {}, &block) ⇒ Object
103 104 105 |
# File 'lib/representable.rb', line 103 def property(name, ={}, &block) representable_attrs << definition_class.new(name, ) end |
#representable_attrs ⇒ Object
95 96 97 |
# File 'lib/representable.rb', line 95 def representable_attrs @representable_attrs ||= build_config end |
#representation_wrap=(name) ⇒ Object
99 100 101 |
# File 'lib/representable.rb', line 99 def representation_wrap=(name) representable_attrs.wrap = name end |