stupidedi 1.2.18 → 1.2.20
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +12 -0
- data/Rakefile +2 -12
- data/lib/stupidedi/version.rb +1 -1
- data/lib/stupidedi/writer/claredi.rb +30 -31
- data/spec/examples/integration/{generating.example → generating_spec.rb} +0 -0
- data/spec/examples/integration/{navigating.example → navigating_spec.rb} +0 -0
- data/spec/examples/integration/parsing/005010/{X091A1-HP835.example → X091A1-HP835_spec.rb} +0 -0
- data/spec/examples/integration/parsing/005010/{X212-HR276.example → X212-HR276_spec.rb} +0 -0
- data/spec/examples/integration/parsing/005010/{X221-HP835.example → X221-HP835_spec.rb} +0 -0
- data/spec/examples/integration/parsing/005010/{X222-HC837.example → X222-HC837_spec.rb} +0 -0
- data/spec/examples/ruby/{array.example → array_spec.rb} +0 -0
- data/spec/examples/ruby/{blank.example → blank_spec.rb} +0 -0
- data/spec/examples/ruby/{count.example → count_spec.rb} +0 -0
- data/spec/examples/ruby/{object.example → object_spec.rb} +0 -0
- data/spec/examples/ruby/{string.example → string_spec.rb} +0 -0
- data/spec/examples/ruby/{symbol.example → symbol_spec.rb} +0 -0
- data/spec/examples/ruby/{to_d.example → to_d_spec.rb} +0 -0
- data/spec/examples/ruby/{try.example → try_spec.rb} +0 -0
- data/spec/examples/stupidedi/{either.example → either_spec.rb} +0 -0
- data/spec/examples/stupidedi/reader/{failure.example → failure_spec.rb} +0 -0
- data/spec/examples/stupidedi/reader/input/{delegated_input.example → delegated_input_spec.rb} +0 -0
- data/spec/examples/stupidedi/reader/{separators.example → separators_spec.rb} +0 -0
- data/spec/examples/stupidedi/reader/{stream_reader.example → stream_reader_spec.rb} +0 -0
- data/spec/examples/stupidedi/reader/{success.example → success_spec.rb} +0 -0
- data/spec/examples/stupidedi/reader/{token_reader.example → token_reader_spec.rb} +0 -0
- data/spec/examples/stupidedi/{reader.example → reader_spec.rb} +0 -0
- data/spec/examples/stupidedi/versions/005010/element_types/{an.example → an_spec.rb} +0 -0
- data/spec/examples/stupidedi/versions/005010/element_types/{dt.example → dt_spec.rb} +0 -0
- data/spec/examples/stupidedi/versions/005010/element_types/{id.example → id_spec.rb} +0 -0
- data/spec/examples/stupidedi/versions/005010/element_types/{nn.example → nn_spec.rb} +0 -0
- data/spec/examples/stupidedi/versions/005010/element_types/{r.example → r_spec.rb} +0 -0
- data/spec/examples/stupidedi/versions/005010/element_types/{tm.example → tm_spec.rb} +0 -0
- data/spec/examples/stupidedi/zipper/{abstract_cursor.example → abstract_cursor_spec.rb} +0 -0
- data/spec/examples/stupidedi/{zipper.example → zipper_spec.rb} +0 -0
- metadata +32 -62
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fc8ac588bac665066d84b4df50b9641d94835f44671ad43a189bad11c6ad8101
|
4
|
+
data.tar.gz: e556a6c96516ee2bd4aae9b2fa5c969331e0ea1d1473e2f32e8f130bfda94989
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9ba36f9939ce14183eb3211ca666115ee420f74f63549bbf751714e55a06f07c0eadfe580383209c5a451cb9d9e02d485efb3536a8a352d7a1214322738585fe
|
7
|
+
data.tar.gz: e68250deed4fc2f0e100cfbf696d3d7d7e419730561fed7cd05e886eccdd44dc450cc133ce9f3015d86a05537d62a99573825137fd05bd4eedddd924b5a1a6d4
|
data/README.md
CHANGED
@@ -301,6 +301,18 @@ b.machine.zipper.tap do |z|
|
|
301
301
|
end
|
302
302
|
```
|
303
303
|
|
304
|
+
Please note that two writers are available. As shown above `Stupidedi::Writer::Default` will output data encoded in plain x12 format. While `Stupidedi::Writer::Claredi` will output a formatted HTML string.
|
305
|
+
|
306
|
+
`Stupidedi::Writer::Claredi#write` operates on `StringIO`.
|
307
|
+
|
308
|
+
```ruby
|
309
|
+
b.machine.zipper.tap do |z|
|
310
|
+
w = Stupidedi::Writer::Claredi.new(z.root)
|
311
|
+
|
312
|
+
File.open('output.html', 'w') { |f| f.write w.write }
|
313
|
+
end
|
314
|
+
```
|
315
|
+
|
304
316
|
### Reading, Traversing
|
305
317
|
|
306
318
|
```ruby
|
data/Rakefile
CHANGED
@@ -2,14 +2,6 @@ require "pathname"
|
|
2
2
|
abspath = Pathname.new(File.dirname(__FILE__)).expand_path
|
3
3
|
relpath = abspath.relative_path_from(Pathname.pwd)
|
4
4
|
|
5
|
-
begin
|
6
|
-
# require "rubygems"
|
7
|
-
# require "bundler/setup"
|
8
|
-
rescue LoadError
|
9
|
-
warn "couldn't load bundler:"
|
10
|
-
warn " #{$!}"
|
11
|
-
end
|
12
|
-
|
13
5
|
task :default => :spec
|
14
6
|
|
15
7
|
task :console do
|
@@ -18,9 +10,9 @@ end
|
|
18
10
|
|
19
11
|
begin
|
20
12
|
require "rspec/core/rake_task"
|
13
|
+
|
21
14
|
RSpec::Core::RakeTask.new do |t|
|
22
15
|
t.verbose = false
|
23
|
-
t.pattern = "#{relpath}/spec/examples/**/*.example"
|
24
16
|
|
25
17
|
t.rspec_opts = %w(--color --format p)
|
26
18
|
t.rspec_opts << "-I#{abspath}/spec"
|
@@ -28,8 +20,8 @@ begin
|
|
28
20
|
rescue LoadError => first
|
29
21
|
begin
|
30
22
|
require "spec/rake/spectask"
|
23
|
+
|
31
24
|
Spec::Rake::SpecTask.new do |t|
|
32
|
-
t.pattern = "#{relpath}/spec/examples/**/*.example"
|
33
25
|
t.spec_opts << "--color"
|
34
26
|
t.spec_opts << "--format p"
|
35
27
|
t.libs << "#{abspath}/spec"
|
@@ -54,7 +46,6 @@ begin
|
|
54
46
|
t.rcov_opts = "--exclude spec/,gems/,00401"
|
55
47
|
|
56
48
|
t.verbose = false
|
57
|
-
t.pattern = "#{relpath}/spec/examples/**/*.example"
|
58
49
|
|
59
50
|
t.rspec_opts = %w(--color --format p)
|
60
51
|
t.rspec_opts << "-I#{abspath}/spec"
|
@@ -66,7 +57,6 @@ begin
|
|
66
57
|
t.rcov = true
|
67
58
|
t.rcov_opts = %w(--exclude spec/,gems/)
|
68
59
|
|
69
|
-
t.pattern = "#{relpath}/spec/examples/**/*.example"
|
70
60
|
t.spec_opts << "--color"
|
71
61
|
t.spec_opts << "--format=p"
|
72
62
|
t.libs << "#{abspath}/spec"
|
data/lib/stupidedi/version.rb
CHANGED
@@ -11,10 +11,12 @@ module Stupidedi
|
|
11
11
|
end
|
12
12
|
|
13
13
|
# @return [String]
|
14
|
-
def write(out =
|
15
|
-
out
|
14
|
+
def write(out = StringIO.new)
|
15
|
+
out << "<html><head>\n#{style}</head>\n<body>\n"
|
16
16
|
build(@node, out)
|
17
|
-
out
|
17
|
+
out << "</body></html>"
|
18
|
+
|
19
|
+
out.string
|
18
20
|
end
|
19
21
|
|
20
22
|
private
|
@@ -77,69 +79,66 @@ module Stupidedi
|
|
77
79
|
end
|
78
80
|
|
79
81
|
# @return [void]
|
80
|
-
def build(node, out =
|
82
|
+
def build(node, out = StringIO.new)
|
81
83
|
if node.element?
|
82
|
-
|
83
84
|
if node.composite?
|
84
|
-
out
|
85
|
-
tmp
|
85
|
+
out << "*"
|
86
|
+
tmp = StringIO.new
|
86
87
|
node.children.each{|e| build(e, tmp) }
|
87
|
-
|
88
|
-
out + tmp
|
88
|
+
out << tmp.string.gsub(/:*$/, "")
|
89
89
|
elsif node.component?
|
90
|
-
out
|
90
|
+
out << "#{node}:"
|
91
91
|
elsif node.repeated?
|
92
|
-
out
|
92
|
+
out << "^"
|
93
93
|
node.children.each{|e| build(e, out) }
|
94
94
|
else
|
95
|
-
out
|
95
|
+
out << "*#{node}"
|
96
96
|
end
|
97
97
|
|
98
98
|
elsif node.segment?
|
99
|
-
out
|
100
|
-
out
|
101
|
-
|
102
|
-
tmp =
|
99
|
+
out << "<div class=segment><div class=label title='#{node.definition.name}'>"
|
100
|
+
out << '% 3s' % node.definition.id
|
101
|
+
# out << ": #{node.definition.name}</div></div>\n"
|
102
|
+
tmp = StringIO.new
|
103
103
|
node.children.each{|e| build(e, tmp) }
|
104
|
-
tmp = tmp.gsub(/\**$/, "")
|
105
|
-
out
|
104
|
+
tmp = tmp.string.gsub(/\**$/, "")
|
105
|
+
out << "#{tmp}~</div></div>\n"
|
106
106
|
|
107
107
|
elsif node.loop?
|
108
108
|
m = /^(\w+) (.+)$/.match(node.definition.id)
|
109
109
|
id, name = m.captures
|
110
110
|
name = name.split(/\s+/).map(&:capitalize).join(" ")
|
111
111
|
|
112
|
-
out
|
112
|
+
out << "<div class=loop><div class=label>#{name} (#{id})</div>\n"
|
113
113
|
node.children.each{|c| build(c, out) }
|
114
|
-
out
|
114
|
+
out << "</div>\n"
|
115
115
|
|
116
116
|
elsif node.table?
|
117
|
-
out
|
117
|
+
out << "<div class=table><div class=label>#{node.definition.id}</div>\n"
|
118
118
|
node.children.each{|c| build(c, out) }
|
119
|
-
out
|
119
|
+
out << "</div>\n"
|
120
120
|
|
121
121
|
elsif node.transaction_set?
|
122
|
-
out
|
122
|
+
out << "<div class=transaction><div class=label>Transaction Set #{node.definition.id}</div>\n"
|
123
123
|
node.children.each{|c| build(c, out) }
|
124
|
-
out
|
124
|
+
out << "</div>\n"
|
125
125
|
|
126
126
|
elsif node.functional_group?
|
127
|
-
out
|
127
|
+
out << "<div class=functionalgr><div class=label>Functional Group #{node.definition.id}</div>\n"
|
128
128
|
node.children.each{|c| build(c, out) }
|
129
|
-
out
|
129
|
+
out << "</div>\n"
|
130
130
|
|
131
131
|
elsif node.interchange?
|
132
|
-
out
|
132
|
+
out << "<div class=interchange><div class=label>Interchange #{node.definition.id}</div>\n"
|
133
133
|
node.children.each{|c| build(c, out) }
|
134
|
-
out
|
134
|
+
out << "</div>\n"
|
135
135
|
|
136
136
|
elsif node.transmission?
|
137
|
-
out
|
137
|
+
out << "<div class=transmission>\n"
|
138
138
|
node.children.each{|c| build(c, out) }
|
139
|
-
out
|
139
|
+
out << "</div>\n"
|
140
140
|
end
|
141
141
|
end
|
142
142
|
end
|
143
|
-
|
144
143
|
end
|
145
144
|
end
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
data/spec/examples/stupidedi/reader/input/{delegated_input.example → delegated_input_spec.rb}
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: stupidedi
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.20
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kyle Putnam/Isi Robayna
|
@@ -971,36 +971,36 @@ files:
|
|
971
971
|
- lib/stupidedi/zipper/memoized_cursor.rb
|
972
972
|
- lib/stupidedi/zipper/path.rb
|
973
973
|
- lib/stupidedi/zipper/root_cursor.rb
|
974
|
-
- spec/examples/integration/
|
975
|
-
- spec/examples/integration/
|
976
|
-
- spec/examples/integration/parsing/005010/X091A1-
|
977
|
-
- spec/examples/integration/parsing/005010/X212-
|
978
|
-
- spec/examples/integration/parsing/005010/X221-
|
979
|
-
- spec/examples/integration/parsing/005010/X222-
|
980
|
-
- spec/examples/ruby/
|
981
|
-
- spec/examples/ruby/
|
982
|
-
- spec/examples/ruby/
|
983
|
-
- spec/examples/ruby/
|
984
|
-
- spec/examples/ruby/
|
985
|
-
- spec/examples/ruby/
|
986
|
-
- spec/examples/ruby/
|
987
|
-
- spec/examples/ruby/
|
988
|
-
- spec/examples/stupidedi/
|
989
|
-
- spec/examples/stupidedi/reader.
|
990
|
-
- spec/examples/stupidedi/reader/
|
991
|
-
- spec/examples/stupidedi/reader/
|
992
|
-
- spec/examples/stupidedi/reader/
|
993
|
-
- spec/examples/stupidedi/reader/
|
994
|
-
- spec/examples/stupidedi/reader/
|
995
|
-
- spec/examples/stupidedi/
|
996
|
-
- spec/examples/stupidedi/versions/005010/element_types/
|
997
|
-
- spec/examples/stupidedi/versions/005010/element_types/
|
998
|
-
- spec/examples/stupidedi/versions/005010/element_types/
|
999
|
-
- spec/examples/stupidedi/versions/005010/element_types/
|
1000
|
-
- spec/examples/stupidedi/versions/005010/element_types/
|
1001
|
-
- spec/examples/stupidedi/versions/005010/element_types/
|
1002
|
-
- spec/examples/stupidedi/zipper.
|
1003
|
-
- spec/examples/stupidedi/
|
974
|
+
- spec/examples/integration/generating_spec.rb
|
975
|
+
- spec/examples/integration/navigating_spec.rb
|
976
|
+
- spec/examples/integration/parsing/005010/X091A1-HP835_spec.rb
|
977
|
+
- spec/examples/integration/parsing/005010/X212-HR276_spec.rb
|
978
|
+
- spec/examples/integration/parsing/005010/X221-HP835_spec.rb
|
979
|
+
- spec/examples/integration/parsing/005010/X222-HC837_spec.rb
|
980
|
+
- spec/examples/ruby/array_spec.rb
|
981
|
+
- spec/examples/ruby/blank_spec.rb
|
982
|
+
- spec/examples/ruby/count_spec.rb
|
983
|
+
- spec/examples/ruby/object_spec.rb
|
984
|
+
- spec/examples/ruby/string_spec.rb
|
985
|
+
- spec/examples/ruby/symbol_spec.rb
|
986
|
+
- spec/examples/ruby/to_d_spec.rb
|
987
|
+
- spec/examples/ruby/try_spec.rb
|
988
|
+
- spec/examples/stupidedi/either_spec.rb
|
989
|
+
- spec/examples/stupidedi/reader/failure_spec.rb
|
990
|
+
- spec/examples/stupidedi/reader/input/delegated_input_spec.rb
|
991
|
+
- spec/examples/stupidedi/reader/separators_spec.rb
|
992
|
+
- spec/examples/stupidedi/reader/stream_reader_spec.rb
|
993
|
+
- spec/examples/stupidedi/reader/success_spec.rb
|
994
|
+
- spec/examples/stupidedi/reader/token_reader_spec.rb
|
995
|
+
- spec/examples/stupidedi/reader_spec.rb
|
996
|
+
- spec/examples/stupidedi/versions/005010/element_types/an_spec.rb
|
997
|
+
- spec/examples/stupidedi/versions/005010/element_types/dt_spec.rb
|
998
|
+
- spec/examples/stupidedi/versions/005010/element_types/id_spec.rb
|
999
|
+
- spec/examples/stupidedi/versions/005010/element_types/nn_spec.rb
|
1000
|
+
- spec/examples/stupidedi/versions/005010/element_types/r_spec.rb
|
1001
|
+
- spec/examples/stupidedi/versions/005010/element_types/tm_spec.rb
|
1002
|
+
- spec/examples/stupidedi/zipper/abstract_cursor_spec.rb
|
1003
|
+
- spec/examples/stupidedi/zipper_spec.rb
|
1004
1004
|
- spec/fixtures/FA997/1-good.txt
|
1005
1005
|
- spec/fixtures/PC860/1-good.txt
|
1006
1006
|
- spec/fixtures/PO830/1-good.txt
|
@@ -1215,34 +1215,4 @@ rubygems_version: 2.7.6
|
|
1215
1215
|
signing_key:
|
1216
1216
|
specification_version: 4
|
1217
1217
|
summary: Parse, generate, validate ASC X12 EDI
|
1218
|
-
test_files:
|
1219
|
-
- spec/examples/stupidedi/reader/failure.example
|
1220
|
-
- spec/examples/stupidedi/reader/input/delegated_input.example
|
1221
|
-
- spec/examples/stupidedi/reader/token_reader.example
|
1222
|
-
- spec/examples/stupidedi/reader/separators.example
|
1223
|
-
- spec/examples/stupidedi/reader/stream_reader.example
|
1224
|
-
- spec/examples/stupidedi/reader/success.example
|
1225
|
-
- spec/examples/stupidedi/either.example
|
1226
|
-
- spec/examples/stupidedi/versions/005010/element_types/r.example
|
1227
|
-
- spec/examples/stupidedi/versions/005010/element_types/id.example
|
1228
|
-
- spec/examples/stupidedi/versions/005010/element_types/nn.example
|
1229
|
-
- spec/examples/stupidedi/versions/005010/element_types/an.example
|
1230
|
-
- spec/examples/stupidedi/versions/005010/element_types/tm.example
|
1231
|
-
- spec/examples/stupidedi/versions/005010/element_types/dt.example
|
1232
|
-
- spec/examples/stupidedi/zipper/abstract_cursor.example
|
1233
|
-
- spec/examples/stupidedi/reader.example
|
1234
|
-
- spec/examples/stupidedi/zipper.example
|
1235
|
-
- spec/examples/integration/generating.example
|
1236
|
-
- spec/examples/integration/navigating.example
|
1237
|
-
- spec/examples/integration/parsing/005010/X212-HR276.example
|
1238
|
-
- spec/examples/integration/parsing/005010/X091A1-HP835.example
|
1239
|
-
- spec/examples/integration/parsing/005010/X221-HP835.example
|
1240
|
-
- spec/examples/integration/parsing/005010/X222-HC837.example
|
1241
|
-
- spec/examples/ruby/to_d.example
|
1242
|
-
- spec/examples/ruby/object.example
|
1243
|
-
- spec/examples/ruby/blank.example
|
1244
|
-
- spec/examples/ruby/array.example
|
1245
|
-
- spec/examples/ruby/count.example
|
1246
|
-
- spec/examples/ruby/try.example
|
1247
|
-
- spec/examples/ruby/string.example
|
1248
|
-
- spec/examples/ruby/symbol.example
|
1218
|
+
test_files: []
|