Module: Cnab::Detalhe

Defined in:
lib/cnab/detalhe.rb,
lib/cnab/detalhe/segmento_t.rb,
lib/cnab/detalhe/segmento_u.rb,
lib/cnab/detalhe/segmento_t_u.rb

Defined Under Namespace

Classes: SegmentoT, SegmentoTU, SegmentoU

Class Method Summary collapse

Class Method Details

.merge(line1, line2, definition) ⇒ Object



18
19
20
# File 'lib/cnab/detalhe.rb', line 18

def self.merge(line1, line2, definition)
  SegmentoTU.new(parse(line1, definition), parse(line2, definition))
end

.parse(line, definition) ⇒ Object



7
8
9
10
11
12
13
14
15
16
# File 'lib/cnab/detalhe.rb', line 7

def self.parse(line, definition)
  case line[13]
    when "T"
      SegmentoT.new(line, definition.segmento_t)
    when "U"
      SegmentoU.new(line, definition.segmento_u)
    else
      raise Exceptions::SegmentNotImplemented
  end
end