nacha 0.1.6 → 0.1.7
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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +7 -0
- data/lib/nacha/parser.rb +2 -1
- data/lib/nacha/record/base.rb +10 -4
- data/lib/nacha/version.rb +1 -1
- data/lib/nacha.rb +21 -10
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8375798ff41c91e7a14ae4ebbf1442f7ceaf83ae7f61c81b1b88c87fd2ca4760
|
4
|
+
data.tar.gz: b35fa722059c4eab240896141868eb27cd2b17c5c17539b5281a5d2a71ccfb07
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f5bd9637030e63e90ca54b3203a09341badba050d4b9351063e2ea6c2da743ecbf33539280e1b7fc03b44a93bfa90fb644ace1cd895a98ee473e7925ca0b0454
|
7
|
+
data.tar.gz: 49b0621426a2609b6f65b4385f159cd053cfd9e7dc6e294850b1bcf7b1c7c723f771d2487e494a9dee0c704c4d572e35f5441c8391ddf2b78460d4c7f2a55b77
|
data/CHANGELOG.md
CHANGED
@@ -7,6 +7,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
7
7
|
|
8
8
|
## [Unreleased]
|
9
9
|
|
10
|
+
## [0.1.7] - 2025-06-23
|
11
|
+
|
12
|
+
- Better parsing. Nacha::Record::FileControl had issues parsing if the reserved
|
13
|
+
part of the record was stripped off. Since the reserved part of the record is
|
14
|
+
all spaces, it can safely be missing.
|
15
|
+
|
16
|
+
|
10
17
|
## [0.1.6] - 2025-06-20
|
11
18
|
|
12
19
|
- Better code coverage
|
data/lib/nacha/parser.rb
CHANGED
data/lib/nacha/record/base.rb
CHANGED
@@ -29,8 +29,6 @@ module Nacha
|
|
29
29
|
end
|
30
30
|
|
31
31
|
class << self
|
32
|
-
attr_reader :nacha_record_name
|
33
|
-
|
34
32
|
def nacha_field(name, inclusion:, contents:, position:)
|
35
33
|
definition[name] = { inclusion: inclusion,
|
36
34
|
contents: contents,
|
@@ -41,7 +39,9 @@ module Nacha
|
|
41
39
|
|
42
40
|
validations[name] ||= []
|
43
41
|
validations[name] << validation_method
|
42
|
+
Nacha.add_ach_record_type(self)
|
44
43
|
end
|
44
|
+
|
45
45
|
def definition
|
46
46
|
@definition ||= {}
|
47
47
|
end
|
@@ -81,8 +81,14 @@ module Nacha
|
|
81
81
|
@matcher ||=
|
82
82
|
Regexp.new('\A' + definition.values.reverse.collect do |d|
|
83
83
|
if d[:contents] =~ /\AC(.+)\z/
|
84
|
-
|
85
|
-
|
84
|
+
last_match = Regexp.last_match(1)
|
85
|
+
if last_match =~ /\A *\z/
|
86
|
+
skipped_output = true
|
87
|
+
''
|
88
|
+
else
|
89
|
+
output_started = true
|
90
|
+
last_match
|
91
|
+
end
|
86
92
|
elsif d[:contents] =~ /\ANumeric\z/
|
87
93
|
if output_started
|
88
94
|
'[0-9 ]' + "{#{(d[:position] || d['position']).size}}"
|
data/lib/nacha/version.rb
CHANGED
data/lib/nacha.rb
CHANGED
@@ -7,16 +7,6 @@ require 'nacha/ach_date'
|
|
7
7
|
require 'nacha/field'
|
8
8
|
require 'nacha/numeric'
|
9
9
|
|
10
|
-
Gem.find_files('nacha/record/*.rb').reject{|f| f =~ /\/spec\//}.each do |file|
|
11
|
-
require File.expand_path(file)
|
12
|
-
end
|
13
|
-
|
14
|
-
Gem.find_files('nacha/record/**/*.rb').reject{|f| f =~ /\/spec\//}.each do |file|
|
15
|
-
require File.expand_path(file)
|
16
|
-
end
|
17
|
-
|
18
|
-
require 'nacha/parser'
|
19
|
-
|
20
10
|
module Nacha
|
21
11
|
STANDARD_ENTRY_CLASS_CODES = %w[ACK ADV ARC ATX BOC CCD PPD CIE
|
22
12
|
COR CTX DNE ENR IAT POP POS SHR
|
@@ -30,6 +20,16 @@ module Nacha
|
|
30
20
|
48 49 55 56 82 84 86 88].freeze
|
31
21
|
|
32
22
|
TRANSACTION_CODES = (CREDIT_TRANSACTION_CODES + DEBIT_TRANSACTION_CODES).freeze
|
23
|
+
@@ach_record_types = []
|
24
|
+
|
25
|
+
def self.add_ach_record_type(klass)
|
26
|
+
@@ach_record_types << klass unless @@ach_record_types.include?(klass)
|
27
|
+
end
|
28
|
+
|
29
|
+
def self.ach_record_types
|
30
|
+
@@ach_record_types
|
31
|
+
end
|
32
|
+
|
33
33
|
class << self
|
34
34
|
def parse(object)
|
35
35
|
parser = Nacha::Parser.new
|
@@ -53,3 +53,14 @@ module Nacha
|
|
53
53
|
end
|
54
54
|
end
|
55
55
|
end
|
56
|
+
|
57
|
+
Gem.find_files('nacha/record/*.rb').reject{|f| f =~ /\/spec\//}.each do |file|
|
58
|
+
require File.expand_path(file)
|
59
|
+
end
|
60
|
+
|
61
|
+
Gem.find_files('nacha/record/**/*.rb').reject{|f| f =~ /\/spec\//}.each do |file|
|
62
|
+
require File.expand_path(file)
|
63
|
+
end
|
64
|
+
|
65
|
+
require 'nacha/parser'
|
66
|
+
|