module MotoRecall::ClassMap

Constants

CLASS_MAP_PATH

Public Class Methods

class_for_make(make) click to toggle source
# 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() click to toggle source
# 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