Class: Scim::Kit::V2::Attribute
- Inherits:
-
Object
- Object
- Scim::Kit::V2::Attribute
- Includes:
- ActiveModel::Validations, Templatable, Attributable
- Defined in:
- lib/scim/kit/v2/attribute.rb
Overview
Represents a SCIM Attribute
Instance Attribute Summary collapse
-
#_value ⇒ Object
Returns the value of attribute _value.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Attributes included from Attributable
Instance Method Summary collapse
- #_assign(new_value, coerce: true) ⇒ Object
-
#initialize(type:, value: nil) ⇒ Attribute
constructor
A new instance of Attribute.
Methods included from Templatable
#as_json, #render, #to_h, #to_json
Methods included from Attributable
Constructor Details
#initialize(type:, value: nil) ⇒ Attribute
Returns a new instance of Attribute.
18 19 20 21 22 |
# File 'lib/scim/kit/v2/attribute.rb', line 18 def initialize(type:, value: nil) @type = type @_value = value define_attributes_for(type.attributes) end |
Instance Attribute Details
#_value ⇒ Object
Returns the value of attribute _value.
12 13 14 |
# File 'lib/scim/kit/v2/attribute.rb', line 12 def _value @_value end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
11 12 13 |
# File 'lib/scim/kit/v2/attribute.rb', line 11 def type @type end |
Instance Method Details
#_assign(new_value, coerce: true) ⇒ Object
24 25 26 |
# File 'lib/scim/kit/v2/attribute.rb', line 24 def _assign(new_value, coerce: true) @_value = coerce ? type.coerce(new_value) : new_value end |