Class: Cornerstore::Property
- Inherits:
-
Model::Base
- Object
- Model::Base
- Cornerstore::Property
- Includes:
- Model::Writable
- Defined in:
- lib/cornerstore/api/property.rb
Defined Under Namespace
Classes: Resource
Instance Attribute Summary collapse
-
#key ⇒ Object
Returns the value of attribute key.
-
#value ⇒ Object
Returns the value of attribute value.
Attributes inherited from Model::Base
#_id, #_slugs, #created_at, #parent, #updated_at
Instance Method Summary collapse
- #attributes ⇒ Object
-
#initialize(attributes = {}, parent = nil) ⇒ Property
constructor
A new instance of Property.
-
#url ⇒ Object
TODO: Rewrite #url on base model to automatically detect parent/url depth.
Methods included from Model::Writable
create, #destroy, #new?, #save, #to_key
Methods inherited from Model::Base
#==, #attributes=, #inspect, method_missing, #method_missing, #to_param
Constructor Details
#initialize(attributes = {}, parent = nil) ⇒ Property
Returns a new instance of Property.
19 20 21 22 23 24 |
# File 'lib/cornerstore/api/property.rb', line 19 def initialize(attributes = {}, parent = nil) @key = attributes.delete(:key) @value = attributes.delete(:value) super end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Cornerstore::Model::Base
Instance Attribute Details
#key ⇒ Object
Returns the value of attribute key.
4 5 6 |
# File 'lib/cornerstore/api/property.rb', line 4 def key @key end |
#value ⇒ Object
Returns the value of attribute value.
4 5 6 |
# File 'lib/cornerstore/api/property.rb', line 4 def value @value end |
Instance Method Details
#attributes ⇒ Object
7 8 9 10 11 12 |
# File 'lib/cornerstore/api/property.rb', line 7 def attributes { key: key, value: value } end |
#url ⇒ Object
TODO: Rewrite #url on base model to automatically detect parent/url depth.
15 16 17 |
# File 'lib/cornerstore/api/property.rb', line 15 def url super(2) end |