Class: JSONAPI::Materializer::Resource::Attribute
- Inherits:
-
Object
- Object
- JSONAPI::Materializer::Resource::Attribute
- Includes:
- ActiveModel::Model
- Defined in:
- lib/jsonapi/materializer/resource/attribute.rb
Instance Attribute Summary collapse
-
#from ⇒ Object
Returns the value of attribute from.
-
#name ⇒ Object
Returns the value of attribute name.
-
#owner ⇒ Object
Returns the value of attribute owner.
Instance Method Summary collapse
- #for(subject) ⇒ Object
-
#initialize(**keyword_arguments) ⇒ Attribute
constructor
A new instance of Attribute.
Constructor Details
#initialize(**keyword_arguments) ⇒ Attribute
Returns a new instance of Attribute.
17 18 19 20 21 |
# File 'lib/jsonapi/materializer/resource/attribute.rb', line 17 def initialize(**keyword_arguments) super(**keyword_arguments) validate! end |
Instance Attribute Details
#from ⇒ Object
Returns the value of attribute from.
11 12 13 |
# File 'lib/jsonapi/materializer/resource/attribute.rb', line 11 def from @from end |
#name ⇒ Object
Returns the value of attribute name.
10 11 12 |
# File 'lib/jsonapi/materializer/resource/attribute.rb', line 10 def name @name end |
#owner ⇒ Object
Returns the value of attribute owner.
9 10 11 |
# File 'lib/jsonapi/materializer/resource/attribute.rb', line 9 def owner @owner end |
Instance Method Details
#for(subject) ⇒ Object
23 24 25 |
# File 'lib/jsonapi/materializer/resource/attribute.rb', line 23 def for(subject) subject.object.public_send(from) end |