cnab 0.4.1 → 0.4.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -6,5 +6,7 @@ module Cnab
6
6
  autoload :TrailerLote, 'cnab/definitions/trailer_lote'
7
7
  autoload :SegmentoT, 'cnab/definitions/segmento_t'
8
8
  autoload :SegmentoU, 'cnab/definitions/segmento_u'
9
+
10
+ autoload :Helper, 'cnab/definitions/helper'
9
11
  end
10
12
  end
@@ -1,14 +1,11 @@
1
1
  module Cnab
2
2
  module Definitions
3
3
  class HeaderArquivo
4
+ include Definitions::Helper
5
+
4
6
  def initialize(version)
5
7
  @definition = YAML.load_file("#{Cnab.lib_path}/cnab/versions/#{version}/header_arquivo.yml")
6
8
  end
7
-
8
- def method_missing(method)
9
- range = @definition[method.to_s].split('..')
10
- Range.new(range[0].to_i, range[1].to_i)
11
- end
12
9
  end
13
10
  end
14
11
  end
@@ -1,14 +1,11 @@
1
1
  module Cnab
2
2
  module Definitions
3
3
  class HeaderLote
4
+ include Definitions::Helper
5
+
4
6
  def initialize(version)
5
7
  @definition = YAML.load_file("#{Cnab.lib_path}/cnab/versions/#{version}/header_lote.yml")
6
8
  end
7
-
8
- def method_missing(method)
9
- range = @definition[method.to_s].split('..')
10
- Integer(range[0])..Integer(range[1])
11
- end
12
9
  end
13
10
  end
14
11
  end
@@ -0,0 +1,15 @@
1
+ module Cnab
2
+ module Definitions
3
+ module Helper
4
+ def method_missing(method_name)
5
+ range = @definition[method_name.to_s].split('..')
6
+ Integer(range[0])..Integer(range[1])
7
+ end
8
+
9
+ def respond_to_missing?(method_name, include_private = false)
10
+ return true unless @definition[method_name.to_s].nil?
11
+ super
12
+ end
13
+ end
14
+ end
15
+ end
@@ -1,14 +1,11 @@
1
1
  module Cnab
2
2
  module Definitions
3
3
  class SegmentoT
4
+ include Definitions::Helper
5
+
4
6
  def initialize(version)
5
7
  @definition = YAML.load_file("#{Cnab.lib_path}/cnab/versions/#{version}/segmento_t.yml")
6
8
  end
7
-
8
- def method_missing(method)
9
- range = @definition[method.to_s].split('..')
10
- Integer(range[0])..Integer(range[1])
11
- end
12
9
  end
13
10
  end
14
11
  end
@@ -1,14 +1,11 @@
1
1
  module Cnab
2
2
  module Definitions
3
3
  class SegmentoU
4
+ include Definitions::Helper
5
+
4
6
  def initialize(version)
5
7
  @definition = YAML.load_file("#{Cnab.lib_path}/cnab/versions/#{version}/segmento_u.yml")
6
8
  end
7
-
8
- def method_missing(method)
9
- range = @definition[method.to_s].split('..')
10
- Integer(range[0])..Integer(range[1])
11
- end
12
9
  end
13
10
  end
14
11
  end
@@ -1,14 +1,11 @@
1
1
  module Cnab
2
2
  module Definitions
3
3
  class TrailerArquivo
4
+ include Definitions::Helper
5
+
4
6
  def initialize(version)
5
7
  @definition = YAML.load_file("#{Cnab.lib_path}/cnab/versions/#{version}/trailer_arquivo.yml")
6
8
  end
7
-
8
- def method_missing(method)
9
- range = @definition[method.to_s].split('..')
10
- Integer(range[0])..Integer(range[1])
11
- end
12
9
  end
13
10
  end
14
11
  end
@@ -1,14 +1,11 @@
1
1
  module Cnab
2
2
  module Definitions
3
3
  class TrailerLote
4
+ include Definitions::Helper
5
+
4
6
  def initialize(version)
5
7
  @definition = YAML.load_file("#{Cnab.lib_path}/cnab/versions/#{version}/trailer_lote.yml")
6
8
  end
7
-
8
- def method_missing(method)
9
- range = @definition[method.to_s].split('..')
10
- Integer(range[0])..Integer(range[1])
11
- end
12
9
  end
13
10
  end
14
11
  end
@@ -1,3 +1,3 @@
1
1
  module Cnab
2
- VERSION = "0.4.1"
2
+ VERSION = "0.4.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cnab
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.1
4
+ version: 0.4.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2013-04-03 00:00:00.000000000 Z
13
+ date: 2013-04-05 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rake
@@ -82,6 +82,7 @@ files:
82
82
  - lib/cnab/definitions.rb
83
83
  - lib/cnab/definitions/header_arquivo.rb
84
84
  - lib/cnab/definitions/header_lote.rb
85
+ - lib/cnab/definitions/helper.rb
85
86
  - lib/cnab/definitions/segmento_t.rb
86
87
  - lib/cnab/definitions/segmento_u.rb
87
88
  - lib/cnab/definitions/trailer_arquivo.rb
@@ -148,7 +149,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
148
149
  version: '0'
149
150
  segments:
150
151
  - 0
151
- hash: -1160814427250196255
152
+ hash: -1092611077032097692
152
153
  required_rubygems_version: !ruby/object:Gem::Requirement
153
154
  none: false
154
155
  requirements:
@@ -157,7 +158,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
157
158
  version: '0'
158
159
  segments:
159
160
  - 0
160
- hash: -1160814427250196255
161
+ hash: -1092611077032097692
161
162
  requirements: []
162
163
  rubyforge_project:
163
164
  rubygems_version: 1.8.25