Module: MotoRecall::ClassMap
- Defined in:
- lib/moto_recall/class_map.rb
Constant Summary collapse
- CLASS_MAP_PATH =
"data/class_map.yml"
Class Method Summary collapse
Class Method Details
.class_for_make(make) ⇒ Object
8 9 10 11 12 13 14 15 |
# File 'lib/moto_recall/class_map.rb', line 8 def self.class_for_make(make) make_class_name = data[make.to_s.downcase] || make.capitalize begin Object.const_get("MotoRecall::Client::#{make_class_name}") rescue NameError raise UnsupportedMakeError, "Invalid Make: #{make}" end end |
.data ⇒ Object
17 18 19 20 21 22 |
# File 'lib/moto_recall/class_map.rb', line 17 def self.data path = File.join(File.dirname(__FILE__), "..", "..", CLASS_MAP_PATH) @data || begin YAML.load_file(path) end end |