Class: Vindetta::Vin::Wmi
- Inherits:
-
Object
- Object
- Vindetta::Vin::Wmi
- Defined in:
- lib/vindetta/vin/wmi.rb
Constant Summary collapse
- DATA_PATH =
File.("../../data/wmi.yaml", __FILE__)
Class Method Summary collapse
Instance Method Summary collapse
- #==(other) ⇒ Object
- #eql? ⇒ Object
-
#initialize(vin) ⇒ Wmi
constructor
A new instance of Wmi.
- #name ⇒ Object
- #region ⇒ Object
- #value ⇒ Object
Constructor Details
#initialize(vin) ⇒ Wmi
Returns a new instance of Wmi.
6 7 8 |
# File 'lib/vindetta/vin/wmi.rb', line 6 def initialize(vin) @vin = vin end |
Class Method Details
.data ⇒ Object
34 35 36 |
# File 'lib/vindetta/vin/wmi.rb', line 34 def self.data @data ||= YAML.load_file(DATA_PATH) end |
Instance Method Details
#==(other) ⇒ Object
30 31 32 |
# File 'lib/vindetta/vin/wmi.rb', line 30 def ==(other) self.class == other.class && value == other.value end |
#eql? ⇒ Object
14 |
# File 'lib/vindetta/vin/wmi.rb', line 14 alias eql? == |
#name ⇒ Object
10 11 12 |
# File 'lib/vindetta/vin/wmi.rb', line 10 def name @name ||= self.class.data["wmi"][value] end |
#region ⇒ Object
20 21 22 23 24 25 26 27 28 |
# File 'lib/vindetta/vin/wmi.rb', line 20 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 |
#value ⇒ Object
16 17 18 |
# File 'lib/vindetta/vin/wmi.rb', line 16 def value @vin[0..2].join("") end |