Method: BankSlip::Barcode#initialize

Defined in:
lib/bank_slip/barcode.rb

#initialize(value:, identification_code:, payment_date:, segment: 1, effective_reference: 6, free_digits: 0, product: 8) ⇒ Barcode

> options = 1, identification_code: 2, document_number: 10, payment_date: Date.new(2010, 3, 10) > barcode = BankSlip::Barcode.new(options)



26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/bank_slip/barcode.rb', line 26

def initialize(value:, identification_code:, payment_date:,
               segment: 1, effective_reference: 6,
               free_digits: 0, product: 8)
  @value               = value
  @segment             = segment
  @identification_code = identification_code
  @payment_date        = payment_date
  @product             = product
  @effective_reference = effective_reference
  @free_digits         = free_digits
  fail "identification_code #{identification_code} too long, #{identification_length} characters is the maximum allowed, for the segment #{segment}"  unless valid_identification_code?
end