formatos-febraban 0.3.45 → 0.3.47

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -32,16 +32,20 @@ class Febraban150
32
32
  #-------------------------------------------------------------------
33
33
  #-------------------------------------------------------------------
34
34
  # Construtor
35
- def initialize(file = '', versao = Febraban150::VERSAO)
35
+ def initialize(file = '', versao = '')
36
36
  @sections = []
37
37
  @versao = versao
38
38
 
39
- self.valida_versao
40
- self. valida_arquivo(file)
39
+ self.valida_versao(file)
40
+ self.valida_arquivo(file)
41
41
  end
42
42
 
43
43
  protected
44
- def valida_versao
44
+ def valida_versao(file)
45
+ if file.size > 0
46
+ @versao = @versao.present? ? @versao : IO.readlines(file)[0][79..80]
47
+ end
48
+
45
49
  unless Febraban150::VersaoDisponivel.include?(@versao)
46
50
  raise "Versão #{@versao} não suportada.
47
51
  Utilizar versões #{Febraban150::VersaoDisponivel.inspect}"
@@ -49,7 +53,7 @@ class Febraban150
49
53
  end
50
54
 
51
55
  def valida_arquivo(file = '')
52
- if file.length > 0
56
+ if file.size > 0
53
57
  self.process_file file
54
58
  end
55
59
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: formatos-febraban
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.45
4
+ version: 0.3.47
5
5
  platform: ruby
6
6
  authors:
7
7
  - José Ricardo Almeida
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2015-05-05 00:00:00.000000000 Z
11
+ date: 2015-05-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler