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