class Nfe::Models::Itens::Prod
Public Class Methods
new()
click to toggle source
# File lib/nfe/models/itens/prod.rb, line 36 def initialize @di = [] @veicProd = VeicProd.new @med = [] @arma = [] @comb = Comb.new end
Private Instance Methods
cean_valid_lenght()
click to toggle source
# File lib/nfe/models/itens/prod.rb, line 100 def cean_valid_lenght [:cEAN, :cEANTrib].each do |attribute| valid_lenght attribute, [0, 8, 12, 13, 14], send(attribute) end end
ncm_valid_lenght()
click to toggle source
# File lib/nfe/models/itens/prod.rb, line 96 def ncm_valid_lenght valid_lenght :ncm, [0, 2, 8], @ncm end
valid_lenght(attribute_name, valid_values, value)
click to toggle source
# File lib/nfe/models/itens/prod.rb, line 106 def valid_lenght(attribute_name, valid_values, value) unless valid_values.include? value.to_s.length errors.add(attribute_name, I18n.t("errors.messages.wrong_length", count: valid_values.to_s)) end end