eddy 0.5.0 → 0.5.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +10 -0
- data/Gemfile.lock +1 -1
- data/README.md +1 -1
- data/lib/eddy/build/loop_builder.rb +3 -3
- data/lib/eddy/build/transaction_set_builder.rb +8 -8
- data/lib/eddy/data/store.rb +1 -7
- data/lib/eddy/models/loop/base.rb +2 -1
- data/lib/eddy/parse.rb +2 -2
- data/lib/eddy/schema/loop_summary.rb +3 -3
- data/lib/eddy/schema/transaction_set_summary.rb +1 -1
- data/lib/eddy/util/trim.rb +2 -2
- data/lib/eddy/version.rb +1 -1
- data/tasks/misc/clean.rake +20 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 24f85e2d1206326cc6a732032561eadf89c12c948ea2adfa1c83381cbff2a347
|
4
|
+
data.tar.gz: 371950e447ceb6b39f75240410e649ad3271e821f2e949ffed583846388b3070
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3133afb573c915663da4214f431c97a692bd339fc101f142d3d313b84a7995c8947ddc4d5f992498b8885510dea003d1354cf02d360e9e92137747bb65ac0035
|
7
|
+
data.tar.gz: f4d9957a4cf3eca9606e762f99e01a76116d3611e5f021d5046be2d789e238689dd9ff1a9ac9de1d078f507377037039c8980625b063d55fdd5492d0f68a31ba
|
data/CHANGELOG.md
CHANGED
@@ -13,6 +13,16 @@ All code should be considered Work In Progress.
|
|
13
13
|
|
14
14
|
While the API is still changing, enough code exists that EDI documents can currently be written with Eddy (though I wouldn't recommend use in production environments yet).
|
15
15
|
|
16
|
+
## 0.5.1 (2020-01-06)
|
17
|
+
|
18
|
+
### Changed
|
19
|
+
|
20
|
+
- Rename variable `loop_id` to `id`.
|
21
|
+
|
22
|
+
### Fixed
|
23
|
+
|
24
|
+
- Fix YARD issues.
|
25
|
+
|
16
26
|
## 0.5.0 (2020-01-05)
|
17
27
|
|
18
28
|
### Changed
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -10,7 +10,7 @@
|
|
10
10
|
[travis-ci]: https://travis-ci.org/tcd/eddy
|
11
11
|
[coveralls]: https://coveralls.io/github/tcd/eddy?branch=master
|
12
12
|
[license]: https://github.com/tcd/eddy/blob/master/LICENSE.txt
|
13
|
-
[docs]: https://www.rubydoc.info/gems/eddy/0.5.
|
13
|
+
[docs]: https://www.rubydoc.info/gems/eddy/0.5.1
|
14
14
|
|
15
15
|
## Installation
|
16
16
|
|
@@ -35,7 +35,7 @@ module Eddy
|
|
35
35
|
return Ginny::Class.create({
|
36
36
|
classify_name: false,
|
37
37
|
parent: "Eddy::Loop::Base",
|
38
|
-
name: self.summary.
|
38
|
+
name: self.summary.id,
|
39
39
|
description: summary.doc_comment(header: true),
|
40
40
|
body: <<~STR.strip,
|
41
41
|
# @param store [Eddy::Data::Store]
|
@@ -62,7 +62,7 @@ module Eddy
|
|
62
62
|
when Eddy::Schema::SegmentSummary
|
63
63
|
comps << " Eddy::Segments::#{comp.id.upcase},"
|
64
64
|
when Eddy::Schema::LoopSummary
|
65
|
-
comps << " Eddy::TransactionSets::#{t_set_id}::Loops::#{comp.
|
65
|
+
comps << " Eddy::TransactionSets::#{t_set_id}::Loops::#{comp.id.upcase},"
|
66
66
|
end
|
67
67
|
end
|
68
68
|
return comps.join("\n ")
|
@@ -78,7 +78,7 @@ module Eddy
|
|
78
78
|
when Eddy::Schema::SegmentSummary
|
79
79
|
yield_params << "# @yieldparam [Eddy::Segments::#{comp.id.upcase}] #{comp.id.downcase}"
|
80
80
|
when Eddy::Schema::LoopSummary
|
81
|
-
yield_params << "# @yieldparam [Eddy::TransactionSets::#{t_set_id}::Loops::#{comp.
|
81
|
+
yield_params << "# @yieldparam [Eddy::TransactionSets::#{t_set_id}::Loops::#{comp.id.upcase}] l_#{comp.id.downcase}"
|
82
82
|
end
|
83
83
|
end
|
84
84
|
return <<~YARD.strip
|
@@ -110,9 +110,9 @@ module Eddy
|
|
110
110
|
decs << "@#{comp.id.downcase} = Eddy::Segments::#{comp.id.upcase}.new(store)\n"
|
111
111
|
when Eddy::Schema::LoopSummary
|
112
112
|
if comp.repeat == 1
|
113
|
-
decs << "@#{comp.
|
113
|
+
decs << "@#{comp.id.downcase} = Eddy::Segments::#{comp.id.upcase}.new(store)\n"
|
114
114
|
else
|
115
|
-
decs << "@l_#{comp.
|
115
|
+
decs << "@l_#{comp.id.downcase} = Eddy::TransactionSets::#{self.summary.normalized_name}::Loops::#{comp.id.upcase}.new(store)\n"
|
116
116
|
end
|
117
117
|
end
|
118
118
|
end
|
@@ -129,9 +129,9 @@ module Eddy
|
|
129
129
|
super_call << " @#{comp.id.downcase},\n"
|
130
130
|
when Eddy::Schema::LoopSummary
|
131
131
|
if comp.repeat == 1
|
132
|
-
super_call << " @#{comp.
|
132
|
+
super_call << " @#{comp.id.downcase},\n"
|
133
133
|
else
|
134
|
-
super_call << " @l_#{comp.
|
134
|
+
super_call << " @l_#{comp.id.downcase},\n"
|
135
135
|
end
|
136
136
|
end
|
137
137
|
end
|
@@ -149,7 +149,7 @@ module Eddy
|
|
149
149
|
Eddy::Build::TransactionSetBuilder.segment_accessor(comp.id)
|
150
150
|
when Eddy::Schema::LoopSummary
|
151
151
|
if comp.repeat == 1
|
152
|
-
Eddy::Build::TransactionSetBuilder.segment_accessor(comp.
|
152
|
+
Eddy::Build::TransactionSetBuilder.segment_accessor(comp.id)
|
153
153
|
else
|
154
154
|
Eddy::Build::TransactionSetBuilder.loop_accessor(comp, self.summary.normalized_name)
|
155
155
|
end
|
@@ -179,8 +179,8 @@ module Eddy
|
|
179
179
|
# @param t_set_name [String]
|
180
180
|
# @return [String]
|
181
181
|
def self.loop_accessor(summary, t_set_name)
|
182
|
-
upper = summary.
|
183
|
-
lower = summary.
|
182
|
+
upper = summary.id.upcase
|
183
|
+
lower = summary.id.downcase
|
184
184
|
return <<~RB.strip
|
185
185
|
# (see Eddy::TransactionSets::#{t_set_name}::Loops::#{upper})
|
186
186
|
#
|
@@ -207,7 +207,7 @@ module Eddy
|
|
207
207
|
when Eddy::Schema::SegmentSummary
|
208
208
|
comps << "# @yieldparam [Eddy::Segments::#{comp.id.upcase}] #{comp.id.downcase}"
|
209
209
|
when Eddy::Schema::LoopSummary
|
210
|
-
comps << "# @yieldparam [Eddy::TransactionSets::#{t_set_name}::Loops::#{comp.
|
210
|
+
comps << "# @yieldparam [Eddy::TransactionSets::#{t_set_name}::Loops::#{comp.id.upcase}] l_#{comp.id.downcase}"
|
211
211
|
end
|
212
212
|
end
|
213
213
|
return comps.join("\n")
|
data/lib/eddy/data/store.rb
CHANGED
@@ -20,7 +20,7 @@ module Eddy
|
|
20
20
|
# @return [String] ("~")
|
21
21
|
attr_accessor :segment_separator
|
22
22
|
# Data Element Separator
|
23
|
-
# @return [String] ("
|
23
|
+
# @return [String] ("\*")
|
24
24
|
attr_accessor :element_separator
|
25
25
|
# QUESTION: is this the same as `component_separator`?
|
26
26
|
#
|
@@ -68,23 +68,17 @@ module Eddy
|
|
68
68
|
self.version_release_industry_id_code = "004010"
|
69
69
|
end
|
70
70
|
|
71
|
-
# (see Eddy::Data.new_interchange_control_number)
|
72
|
-
#
|
73
71
|
# @return [Integer]
|
74
72
|
def interchange_control_number()
|
75
73
|
return Eddy::Data.new_interchange_control_number()
|
76
74
|
end
|
77
75
|
|
78
|
-
# (see Eddy::Data.new_transaction_set_control_number)
|
79
|
-
#
|
80
76
|
# @param transaction_set_id [String]
|
81
77
|
# @return [Integer]
|
82
78
|
def transaction_set_control_number(transaction_set_id)
|
83
79
|
return Eddy::Data.new_transaction_set_control_number(transaction_set_id)
|
84
80
|
end
|
85
81
|
|
86
|
-
# (see Eddy::Data.new_interchange_control_number)
|
87
|
-
#
|
88
82
|
# @param functional_group [String]
|
89
83
|
# @return [Integer]
|
90
84
|
def functional_group_control_number(functional_group)
|
@@ -9,8 +9,9 @@ module Eddy
|
|
9
9
|
class Base
|
10
10
|
|
11
11
|
# (Name) A unique string used to identify the Loop within its Transaction Set.
|
12
|
+
# This is not EDI standardized, any name will do.
|
12
13
|
# @return [String]
|
13
|
-
attr_reader :
|
14
|
+
attr_reader :id
|
14
15
|
# Number of times a particular Loop may be repeated.
|
15
16
|
# @return [Integer]
|
16
17
|
attr_reader :repeat
|
data/lib/eddy/parse.rb
CHANGED
@@ -12,13 +12,13 @@ module Eddy
|
|
12
12
|
# @return [String] ("~")
|
13
13
|
attr_accessor :segment_separator
|
14
14
|
# Data Element Separator
|
15
|
-
# @return [String] ("
|
15
|
+
# @return [String] ("\*")
|
16
16
|
attr_accessor :element_separator
|
17
17
|
|
18
18
|
# @param doc [String] EDI document.
|
19
19
|
# @param component_separator [String] (">")
|
20
20
|
# @param segment_separator [String] ("~")
|
21
|
-
# @param element_separator [String] ("
|
21
|
+
# @param element_separator [String] ("\*")
|
22
22
|
# @return [void]
|
23
23
|
def initialize(doc, component_separator: ">", segment_separator: "~", element_separator: "*")
|
24
24
|
self.document = doc
|
@@ -5,7 +5,7 @@ module Eddy
|
|
5
5
|
|
6
6
|
# A unique string used to identify the Loop within its Transaction Set.
|
7
7
|
# @return [String]
|
8
|
-
attr_accessor :
|
8
|
+
attr_accessor :id
|
9
9
|
# Number of times a particular Loop may be repeated.
|
10
10
|
# @return [Integer]
|
11
11
|
attr_accessor :repeat
|
@@ -31,7 +31,7 @@ module Eddy
|
|
31
31
|
# @return [self]
|
32
32
|
def self.create(params = {})
|
33
33
|
l = LoopSummary.new
|
34
|
-
l.
|
34
|
+
l.id = params[:loop_id]
|
35
35
|
l.repeat = params[:repeat]
|
36
36
|
l.notes = params[:notes]
|
37
37
|
l.level = params[:level]
|
@@ -70,7 +70,7 @@ module Eddy
|
|
70
70
|
self.components.each do |comp|
|
71
71
|
case comp
|
72
72
|
when Eddy::Schema::SegmentSummary then comps << " - #{comp.id.upcase}\n"
|
73
|
-
when Eddy::Schema::LoopSummary then comps << " - #{comp.
|
73
|
+
when Eddy::Schema::LoopSummary then comps << " - #{comp.id.upcase} (loop)\n"
|
74
74
|
end
|
75
75
|
end
|
76
76
|
parts = []
|
@@ -88,7 +88,7 @@ module Eddy
|
|
88
88
|
#
|
89
89
|
# @return [Array<Eddy::Schema::SegmentSummary, Eddy::Schema::LoopSummary>]
|
90
90
|
def unique_loops()
|
91
|
-
return self.all_components.select { |c| c.is_a?(Eddy::Schema::LoopSummary) }.uniq(&:
|
91
|
+
return self.all_components.select { |c| c.is_a?(Eddy::Schema::LoopSummary) }.uniq(&:id)
|
92
92
|
end
|
93
93
|
|
94
94
|
end
|
data/lib/eddy/util/trim.rb
CHANGED
@@ -5,7 +5,7 @@ module Eddy
|
|
5
5
|
# See: [Trailing delimiters and 999 response - X12 RFI](http://www.x12.org/rfis/Trailing%20delimiters%20and%20999%20response.pdf)
|
6
6
|
#
|
7
7
|
# @param itch [String] String containing an EDI Interchange.
|
8
|
-
# @param element_separator [String] ("
|
8
|
+
# @param element_separator [String] ("\*")
|
9
9
|
# @param segment_separator [String] ("~")
|
10
10
|
# @return [String]
|
11
11
|
def self.trim_delims_from_interchange(itch, element_separator: "*", segment_separator: "~")
|
@@ -17,7 +17,7 @@ module Eddy
|
|
17
17
|
# See: [Trailing delimiters and 999 response - X12 RFI](http://www.x12.org/rfis/Trailing%20delimiters%20and%20999%20response.pdf)
|
18
18
|
#
|
19
19
|
# @param segment [String] String containing an EDI segment.
|
20
|
-
# @param separator [String] ("
|
20
|
+
# @param separator [String] ("\*")
|
21
21
|
# @return [String]
|
22
22
|
def self.trim_delims_from_segment(segment, separator: "*")
|
23
23
|
e_sep = Regexp.escape(separator)
|
data/lib/eddy/version.rb
CHANGED
@@ -0,0 +1,20 @@
|
|
1
|
+
require "eddy"
|
2
|
+
require "fileutils"
|
3
|
+
|
4
|
+
namespace :misc do
|
5
|
+
desc "Clean up temporary folders in project root"
|
6
|
+
task :clean do
|
7
|
+
dirs = [
|
8
|
+
"build",
|
9
|
+
"coverage",
|
10
|
+
"doc",
|
11
|
+
"tmp",
|
12
|
+
".yardoc",
|
13
|
+
].each do |dir|
|
14
|
+
path = File.join(Eddy::Util.root_dir, dir)
|
15
|
+
if File.exist?(path)
|
16
|
+
FileUtils.rm_r(dir)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: eddy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Clay Dunston
|
@@ -1542,6 +1542,7 @@ files:
|
|
1542
1542
|
- lib/eddy/util/trim.rb
|
1543
1543
|
- lib/eddy/version.rb
|
1544
1544
|
- tasks/build.rake
|
1545
|
+
- tasks/misc/clean.rake
|
1545
1546
|
- tasks/misc/gemspec.rake
|
1546
1547
|
- tasks/misc/missing_lists.rake
|
1547
1548
|
- tasks/misc/yaml2json.rake
|
@@ -1553,7 +1554,7 @@ metadata:
|
|
1553
1554
|
homepage_uri: https://github.com/tcd/eddy
|
1554
1555
|
source_code_uri: https://github.com/tcd/eddy
|
1555
1556
|
changelog_uri: https://github.com/tcd/eddy/blob/master/CHANGELOG.md
|
1556
|
-
documentation_uri: https://www.rubydoc.info/gems/eddy/0.5.
|
1557
|
+
documentation_uri: https://www.rubydoc.info/gems/eddy/0.5.1
|
1557
1558
|
yard.run: yri
|
1558
1559
|
post_install_message:
|
1559
1560
|
rdoc_options: []
|