Class: VinValidator::BaseModel

Inherits:
Object
  • Object
show all
Defined in:
lib/vin_validator/base_model.rb

Direct Known Subclasses

Maker, Wmi, Year

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(*_args, **_kwargs) ⇒ BaseModel

:nodoc:



32
33
# File 'lib/vin_validator/base_model.rb', line 32

def initialize(*_args, **_kwargs)
end

Class Method Details

.allHash

Loads all objects

Returns:

  • (Hash)


10
11
12
13
14
15
16
17
18
# File 'lib/vin_validator/base_model.rb', line 10

def all
  return @all if defined?(@all)

  all = JSON.parse(File.read(File.join(__dir__, "#{filename}.json")), { symbolize_names: true }).map do |id, v|
    [id.to_s, new(**v)]
  end

  @all = all.to_h
end