Class: VinValidator::BaseModel
- Inherits:
-
Object
- Object
- VinValidator::BaseModel
- Defined in:
- lib/vin_validator/base_model.rb
Class Method Summary collapse
-
.all ⇒ Hash
Loads all objects.
Instance Method Summary collapse
-
#initialize(*_args, **_kwargs) ⇒ BaseModel
constructor
:nodoc:.
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
.all ⇒ Hash
Loads all objects
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 |