Module: Jsapi::Model::Nestable

Included in:
Controller::Parameters, JSON::Object
Defined in:
lib/jsapi/model/nestable.rb

Instance Method Summary collapse

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.

Returns:

  • (Boolean)


13
14
15
# File 'lib/jsapi/model/nestable.rb', line 13

def attribute?(name)
  raw_attributes.key?(name&.to_s)
end

#attributesObject

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