Class: JSONAPI::Document::Meta

Inherits:
NameValuePairCollection show all
Defined in:
lib/easy/jsonapi/document/meta.rb,
lib/easy/jsonapi/document/meta/meta_member.rb

Overview

The meta of a resource

Defined Under Namespace

Classes: MetaMember

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(meta_arr = []) ⇒ Meta

Returns a new instance of Meta.

Parameters:

  • meta_arr (Array<JSONAPI::Document::Meta::MetaMember] The array of meta members to initialize the collection with) (defaults to: [])

    eta_arr [Array<JSONAPI::Document::Meta::MetaMember] The array of meta members to initialize the collection with



14
15
16
17
# File 'lib/easy/jsonapi/document/meta.rb', line 14

def initialize(meta_arr = [])
  meta_arr = [meta_arr] unless meta_arr.is_a? Array
  super(meta_arr, item_type: JSONAPI::Document::Meta::MetaMember)
end

Dynamic Method Handling

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

Instance Method Details

#add(meta_member) ⇒ Object

Add a jsonapi member to the collection

Parameters:



21
22
23
# File 'lib/easy/jsonapi/document/meta.rb', line 21

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