Class: VinValidator::Year
- Defined in:
- lib/vin_validator/year.rb
Instance Attribute Summary collapse
Class Method Summary collapse
-
.find_by(letter:) ⇒ VinValidator::Year
Finds the year with the given ‘letter`.
Instance Method Summary collapse
-
#initialize(id:, year:, letter:) ⇒ Year
constructor
:nodoc:.
Methods inherited from BaseModel
Constructor Details
#initialize(id:, year:, letter:) ⇒ Year
:nodoc:
30 31 32 33 34 35 36 |
# File 'lib/vin_validator/year.rb', line 30 def initialize(id:, year:, letter:) super @id = id @year = year @letter = letter end |
Instance Attribute Details
#id ⇒ Integer
23 24 25 |
# File 'lib/vin_validator/year.rb', line 23 def id @id end |
#letter ⇒ String
27 28 29 |
# File 'lib/vin_validator/year.rb', line 27 def letter @letter end |
#year ⇒ Integer
25 26 27 |
# File 'lib/vin_validator/year.rb', line 25 def year @year end |
Class Method Details
.find_by(letter:) ⇒ VinValidator::Year
Finds the year with the given ‘letter`
10 11 12 |
# File 'lib/vin_validator/year.rb', line 10 def find_by(letter:) all.dig(letter.to_s) end |