class CarBrands
Public Class Methods
brands()
click to toggle source
# File lib/carbrands.rb, line 9 def self.brands YAML.load_file(File.join(File.dirname(__FILE__),"carbrands/brands.yml")) end
detect_brand(str)
click to toggle source
# File lib/carbrands.rb, line 19 def self.detect_brand(str) YAML.load_file(File.join(File.dirname(__FILE__),"carbrands/detectors.yml")).each do |brand,detectors| detectors.each do |detector| return brand if str.include? detector end end end
models_of(brand)
click to toggle source
# File lib/carbrands.rb, line 5 def self.models_of(brand) CarBrands.brands[brand.to_s.upcase] end
popular_brands()
click to toggle source
# File lib/carbrands.rb, line 13 def self.popular_brands unpop=%w{ACURA ALPINA ARO ASIA BRILLIANCE CATERHAM CHANGFENG COGGIOLA CUMMINS DADI DAIHATSU DERWAYS DEUTZ DONGFENG DONINVEST DONKERVOORT EAGLE FAW GEELY GEO HAFEI HUANGHAI IKARUS JAC KOENIGSEGG KUBOTA LANDWIND LEYLAND LEYLAND-DAF LIAZ LIFAN LOTUS MACK MAGIRUS-DEUTZ MAHINDRA MARUTI METROCAB MG MICROCAR MITSUOKA MORGAN MULTICAR OLDSMOBILE PAGANI PERKINS PLYMOUTH PROTON PUCH SALEEN SATURN SCION SHUANGHUAN SPYKER TIANMA TIANYE TVR TATRA TRABANT VECTOR} unpop+=["WARTBURG", "WIESMANN", "XIN KAI", "ZX", "ВАЗ", "ГАЗ", "ЗИЛ", "КАМАЗ", "СеАЗ", "УАЗ", "GREAT WALL", "IRAN KHODRO"] self.brands.delete_if{|k,v| unpop.include? k} end