Class: Unidom::ArticleNumber::VehicleIdentificationNumber

Inherits:
ApplicationRecord
  • Object
show all
Includes:
Concerns::AsBarcode, Common::Concerns::ModelExtension
Defined in:
app/models/unidom/article_number/vehicle_identification_number.rb

Instance Method Summary collapse

Instance Method Details

#code=(code) ⇒ Object



22
23
24
25
26
27
28
29
30
31
# File 'app/models/unidom/article_number/vehicle_identification_number.rb', line 22

def code=(code)
  code = code.to_s
  write_attribute :code, code
  if code.present?
    write_attribute :world_manufacturer_identifier, code[0..2]
    write_attribute :vehicle_descriptor_section,    code[3..7]
    write_attribute :check_digit,                   code[8]
    write_attribute :vehicle_identifier_section,    code[9..16]
  end
end