class Freesound::Collections::Base

Collections are required to tell ActiveResource how to parse JSON responses that wrap a collection of resources.

The #__collection_key method determines the JSON key containing the resource data.

Public Class Methods

new(parsed={}) click to toggle source
# File lib/freesound/collections.rb, line 12
def initialize(parsed={})
  @elements = parsed.fetch(__collection_key)
end

Private Instance Methods

__collection_key() click to toggle source
# File lib/freesound/collections.rb, line 18
def __collection_key
  self.class.name.demodulize.underscore
end