Method: Megam::FlavorsCollection#lookup
- Defined in:
- lib/megam/core/flavors_collection.rb
#lookup(flavors) ⇒ Object
73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 |
# File 'lib/megam/core/flavors_collection.rb', line 73 def lookup(flavors) lookup_by = nil if events.kind_of?(Megam::Flavors) lookup_by = flavors.account_id elsif flavors.kind_of?(String) lookup_by = flavors else raise ArgumentError, "Must pass a Megam::Flavors or String to lookup" end res = @flavors_by_name[lookup_by] unless res raise ArgumentError, "Cannot find a node matching #{lookup_by} (did you define it first?)" end @flavors[res] end |