Module: Jsapi::Model::Nestable
- Included in:
- Controller::Parameters, JSON::Object
- Defined in:
- lib/jsapi/model/nestable.rb
Instance Method Summary collapse
-
#[](name) ⇒ Object
Returns the value assigned to
name. -
#attribute?(name) ⇒ Boolean
Returns
trueifnameis present, falseotherwise. -
#attributes ⇒ Object
Returns a
Hashcontaining all attributes.
Instance Method Details
#[](name) ⇒ Object
Returns the value assigned to name.
8 9 10 |
# File 'lib/jsapi/model/nestable.rb', line 8 def [](name) raw_attributes[name&.to_s]&.value end |
#attribute?(name) ⇒ Boolean
Returns true if name is present, false otherwise.
13 14 15 |
# File 'lib/jsapi/model/nestable.rb', line 13 def attribute?(name) raw_attributes.key?(name&.to_s) end |
#attributes ⇒ Object
Returns a Hash containing all attributes.
18 19 20 |
# File 'lib/jsapi/model/nestable.rb', line 18 def attributes raw_attributes.transform_values(&:value) end |