Class: CNAB240::BancoABC::Entities::RegisterU

Inherits:
Base
  • Object
show all
Defined in:
lib/cnab240/bancoabc/entities/register_u.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#header?, #trailler?

Constructor Details

#initialize(line) ⇒ RegisterU

Returns a new instance of RegisterU.



9
10
11
# File 'lib/cnab240/bancoabc/entities/register_u.rb', line 9

def initialize(line)
  @line = line
end

Instance Attribute Details

#lineObject (readonly)

Returns the value of attribute line.



7
8
9
# File 'lib/cnab240/bancoabc/entities/register_u.rb', line 7

def line
  @line
end

Instance Method Details

#acrescimosObject



37
38
39
# File 'lib/cnab240/bancoabc/entities/register_u.rb', line 37

def acrescimos
  line[17..31]
end

#dataObject



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/cnab240/bancoabc/entities/register_u.rb', line 17

def data
  {
    segmento: segmento.strip,
    acrescimos: acrescimos.strip,
    valor_desconto: valor_desconto.strip,
    valor_abatimento: valor_abatimento.strip,
    valor_iof: valor_iof.strip,
    valor_pago: valor_pago.strip,
    valor_liquido: valor_liquido.strip,
    valor_outras_despesas: valor_outras_despesas.strip,
    valor_outros_creditos: valor_outros_creditos.strip,
    data_ocorrencia: data_ocorrencia.strip,
    data_credito: data_credito.strip
  }
end

#data_creditoObject



73
74
75
# File 'lib/cnab240/bancoabc/entities/register_u.rb', line 73

def data_credito
  line[145..152]
end

#data_ocorrenciaObject



69
70
71
# File 'lib/cnab240/bancoabc/entities/register_u.rb', line 69

def data_ocorrencia
  line[137..144]
end

#register?Boolean

Returns:

  • (Boolean)


13
14
15
# File 'lib/cnab240/bancoabc/entities/register_u.rb', line 13

def register?
  true
end

#segmentoObject



33
34
35
# File 'lib/cnab240/bancoabc/entities/register_u.rb', line 33

def segmento
  line[13]
end

#valor_abatimentoObject



45
46
47
# File 'lib/cnab240/bancoabc/entities/register_u.rb', line 45

def valor_abatimento
  line[47..61]
end

#valor_descontoObject



41
42
43
# File 'lib/cnab240/bancoabc/entities/register_u.rb', line 41

def valor_desconto
  line[32..46]
end

#valor_iofObject



49
50
51
# File 'lib/cnab240/bancoabc/entities/register_u.rb', line 49

def valor_iof
  line[62..76]
end

#valor_liquidoObject



57
58
59
# File 'lib/cnab240/bancoabc/entities/register_u.rb', line 57

def valor_liquido
  line[92..106]
end

#valor_outras_despesasObject



61
62
63
# File 'lib/cnab240/bancoabc/entities/register_u.rb', line 61

def valor_outras_despesas
  line[107..121]
end

#valor_outros_creditosObject



65
66
67
# File 'lib/cnab240/bancoabc/entities/register_u.rb', line 65

def valor_outros_creditos
  line[122..136]
end

#valor_pagoObject



53
54
55
# File 'lib/cnab240/bancoabc/entities/register_u.rb', line 53

def valor_pago
  line[77..91]
end