Class: Beatport::Catalog::Feature

Inherits:
Item
  • Object
show all
Defined in:
lib/beatport/catalog/feature.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Item

#[], #associate, associations, find_by_name, has_many, has_one, #id, lazy_accessor, #type

Constructor Details

#initialize(data = {}) ⇒ Feature

Returns a new instance of Feature.



8
9
10
11
12
13
# File 'lib/beatport/catalog/feature.rb', line 8

def initialize(data = {})
  item_klass = Support::Inflector.constantize("Beatport::Catalog::#{data['type']}")

  associate(data, 'items', true, item_klass)
  super
end

Instance Attribute Details

#itemsObject (readonly)

associated this manually since we don’t know the type of the items by default



6
7
8
# File 'lib/beatport/catalog/feature.rb', line 6

def items
  @items
end