Module: JSON::Encodable::ClassMethods
- Defined in:
- lib/json/encodable.rb
Instance Attribute Summary collapse
Instance Method Summary collapse
- #inherited(child) ⇒ Object
- #property(property_name, options = {}) ⇒ Object
- #property_names ⇒ Array<Symbol>
Instance Attribute Details
#properties ⇒ Array<JSON::Encodable::Property>
92 93 94 |
# File 'lib/json/encodable.rb', line 92 def properties @properties ||= [] end |
Instance Method Details
#inherited(child) ⇒ Object
Note:
Override
102 103 104 105 |
# File 'lib/json/encodable.rb', line 102 def inherited(child) super child.properties = properties.clone end |
#property(property_name, options = {}) ⇒ Object
97 98 99 |
# File 'lib/json/encodable.rb', line 97 def property(property_name, = {}) properties << ::JSON::Encodable::Property.new(property_name, ) end |
#property_names ⇒ Array<Symbol>
87 88 89 |
# File 'lib/json/encodable.rb', line 87 def property_names properties.map(&:name) end |