lib/vindetta/vin/wmi.rb in vindetta-0.8.0 vs lib/vindetta/vin/wmi.rb in vindetta-0.9.0
- old
+ new
@@ -6,16 +6,26 @@
def initialize(vin)
@vin = vin
end
def name
- @name ||= self.class.data[value]
+ @name ||= self.class.data["wmi"][value]
end
alias eql? ==
def value
@vin[0..2].join("")
+ end
+
+ def region
+ @name ||= begin
+ regions = self.class.data["region"] # TODO: Pull this out into private method
+
+ regions.detect do |key, characters_for_region|
+ break key if characters_for_region.include?(value[0])
+ end
+ end
end
def ==(other)
self.class == other.class && value == other.value
end