Module: JSON::Encodable::ClassMethods
- Defined in:
- lib/json/encodable.rb
Instance Attribute Summary collapse
-
#property_names ⇒ Array
Stores property names, used to build JSON properties.
Instance Method Summary collapse
-
#inherited(child) ⇒ Object
Inherits property_names, while they are not shared between a parent and their children.
-
#property(property_name) ⇒ Object
Defines a given property name as a property of the JSON prepresentation its class.
Instance Attribute Details
#property_names ⇒ Array
Stores property names, used to build JSON properties
90 91 92 |
# File 'lib/json/encodable.rb', line 90 def property_names @property_names ||= [] end |
Instance Method Details
#inherited(child) ⇒ Object
Note:
Override
Inherits property_names, while they are not shared between a parent and their children
102 103 104 105 |
# File 'lib/json/encodable.rb', line 102 def inherited(child) super child.property_names = property_names.clone end |
#property(property_name) ⇒ Object
Defines a given property name as a property of the JSON prepresentation its class
96 97 98 |
# File 'lib/json/encodable.rb', line 96 def property(property_name) property_names << property_name end |