Method: JSONAPI::Utility.to_h_collection

Defined in:
lib/easy/jsonapi/utility.rb

.to_h_collection(collection) ⇒ Object

To hash method for a JSONAPI collection (like Attributes)

Parameters:

  • collection (Inumerable)

    The collection to hashify



12
13
14
15
16
17
18
19
# File 'lib/easy/jsonapi/utility.rb', line 12

def to_h_collection(collection)
  to_return = {}
  collection.each do |mem|
    h_val = JSONAPI::Utility.to_h_value(mem)
    to_return[mem.name.to_sym] = h_val
  end
  to_return
end