Module: WarrantyCheck
- Defined in:
- lib/classify.rb,
lib/vendors/hp_vendor.rb,
lib/vendors/ibm_vendor.rb,
lib/vendors/base_vendor.rb,
lib/vendors/dell_vendor.rb,
lib/vendors/apple_vendor.rb,
lib/vendors/fujitsu_vendor.rb
Defined Under Namespace
Classes: APPLE, BaseVendor, DELL, FUJITSU, HP, IBM
Constant Summary collapse
- VENDOR_PATTERNS =
{ WarrantyCheck::HP => ["^[a-zA-Z]{3}[0-9]{3}[0-9a-zA-Z]{4}$"], # 10 WarrantyCheck::DELL => ["^[0-9a-zA-Z]{5,7}$"], # 5-7 WarrantyCheck::IBM => ["^[0-9a-zA-Z]{7}$", "^[0-9a-zA-Z]{10}$", "^[0-9a-zA-Z]{12}$"], # 7,10,12 }
Class Method Summary collapse
Class Method Details
.classify(sn) ⇒ Object
10 11 12 13 14 15 16 17 |
# File 'lib/classify.rb', line 10 def self.classify(sn) matched = [] VENDOR_PATTERNS.each_pair do |vendor, regexps| matched << vendor if regexps.count { |rstr| r = Regexp.new(rstr); !r.match(sn).nil? } > 0 end matched end |