Class: JSONAPI::Document::Resource::Attributes

Inherits:
NameValuePairCollection show all
Defined in:
lib/easy/jsonapi/document/resource/attributes.rb,
lib/easy/jsonapi/document/resource/attributes/attribute.rb

Overview

The attributes of a resource

Defined Under Namespace

Classes: Attribute

Instance Method Summary collapse

Methods inherited from NameValuePairCollection

#<<, #to_h, #to_s

Methods inherited from Collection

#[], #[]=, #each, #empty?, #get, #include?, #insert, #keys, #remove, #set, #size, #to_s

Constructor Details

#initialize(attr_arr = []) ⇒ Attributes

Returns a new instance of Attributes.

Parameters:



14
15
16
# File 'lib/easy/jsonapi/document/resource/attributes.rb', line 14

def initialize(attr_arr = [])
  super(attr_arr, item_type: JSONAPI::Document::Resource::Attributes::Attribute)
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class JSONAPI::NameValuePairCollection

Instance Method Details

#add(attribute) ⇒ Object

Add a jsonapi member to the collection

Parameters:



20
21
22
# File 'lib/easy/jsonapi/document/resource/attributes.rb', line 20

def add(attribute)
  super(attribute, &:name)
end