Class: VinValidator::Year

Inherits:
BaseModel show all
Defined in:
lib/vin_validator/year.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

all

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

#idInteger

Returns:

  • (Integer)


23
24
25
# File 'lib/vin_validator/year.rb', line 23

def id
  @id
end

#letterString

Returns:

  • (String)


27
28
29
# File 'lib/vin_validator/year.rb', line 27

def letter
  @letter
end

#yearInteger

Returns:

  • (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`

Returns:



10
11
12
# File 'lib/vin_validator/year.rb', line 10

def find_by(letter:)
  all.dig(letter.to_s)
end