Class: CNAB240::BancoABC::Entities::Header

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#register?, #trailler?

Constructor Details

#initialize(line) ⇒ Header

Returns a new instance of Header.



9
10
11
# File 'lib/cnab240/bancoabc/entities/header.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/header.rb', line 7

def line
  @line
end

Instance Method Details

#codigo_do_bancoObject



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

def codigo_do_banco
  line[0..2]
end

#codigo_identificacao_empresa_bancoObject



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

def codigo_identificacao_empresa_banco
  line[32..71]
end

#codigo_retornoObject



81
82
83
# File 'lib/cnab240/bancoabc/entities/header.rb', line 81

def codigo_retorno
  line[142]
end

#dataObject



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/cnab240/bancoabc/entities/header.rb', line 17

def data
  {
    codigo_do_banco: codigo_do_banco.strip,
    lote_servico: lote_servico.strip,
    tipo_servico: tipo_servico.strip,
    uso_exclusivo_febraban_1: uso_exclusivo_febraban_1.strip,
    tipo_inscricao_da_empresa: tipo_inscricao_da_empresa.strip,
    numero_inscricao_da_empresa: numero_inscricao_da_empresa.strip,
    codigo_identificacao_empresa_banco: codigo_identificacao_empresa_banco.strip,
    nome_empresa: nome_empresa.strip,
    nome_banco: nome_banco.strip,
    uso_exclusivo_febraban_2: uso_exclusivo_febraban_2.strip,
    codigo_retorno: codigo_retorno.strip,
    data_geracao: data_geracao.strip,
    hora_geracao: hora_geracao.strip,
    numero_sequencial: numero_sequencial.strip,
    numero_versao_layout: numero_versao_layout.strip,
    desidade_gravacao_arquivo: desidade_gravacao_arquivo.strip,
    uso_reservado_banco: uso_reservado_banco.strip,
    uso_reservado_empresa: uso_reservado_empresa.strip,
    uso_exclusivo_febraban_3: uso_exclusivo_febraban_3.strip
  }
end

#data_geracaoObject



85
86
87
# File 'lib/cnab240/bancoabc/entities/header.rb', line 85

def data_geracao
  line[143..150]
end

#desidade_gravacao_arquivoObject



101
102
103
# File 'lib/cnab240/bancoabc/entities/header.rb', line 101

def desidade_gravacao_arquivo
  line[166..170]
end

#header?Boolean

Returns:

  • (Boolean)


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

def header?
  true
end

#hora_geracaoObject



89
90
91
# File 'lib/cnab240/bancoabc/entities/header.rb', line 89

def hora_geracao
  line[151..156]
end

#lote_servicoObject



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

def lote_servico
  line[3..6]
end

#nome_bancoObject



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

def nome_banco
  line[102..131]
end

#nome_empresaObject



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

def nome_empresa
  line[72..101]
end

#numero_inscricao_da_empresaObject



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

def numero_inscricao_da_empresa
  line[18..31]
end

#numero_sequencialObject



93
94
95
# File 'lib/cnab240/bancoabc/entities/header.rb', line 93

def numero_sequencial
  line[157..162]
end

#numero_versao_layoutObject



97
98
99
# File 'lib/cnab240/bancoabc/entities/header.rb', line 97

def numero_versao_layout
  line[163..165]
end

#tipo_inscricao_da_empresaObject



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

def tipo_inscricao_da_empresa
  line[17]
end

#tipo_servicoObject



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

def tipo_servico
  line[7]
end

#uso_exclusivo_febraban_1Object



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

def uso_exclusivo_febraban_1
  line[8..16]
end

#uso_exclusivo_febraban_2Object



77
78
79
# File 'lib/cnab240/bancoabc/entities/header.rb', line 77

def uso_exclusivo_febraban_2
  line[132..141]
end

#uso_exclusivo_febraban_3Object



113
114
115
# File 'lib/cnab240/bancoabc/entities/header.rb', line 113

def uso_exclusivo_febraban_3
  line[211..239]
end

#uso_reservado_bancoObject



105
106
107
# File 'lib/cnab240/bancoabc/entities/header.rb', line 105

def uso_reservado_banco
  line[171..190]
end

#uso_reservado_empresaObject



109
110
111
# File 'lib/cnab240/bancoabc/entities/header.rb', line 109

def uso_reservado_empresa
  line[191..210]
end