stupidedi 1.2.15 → 1.2.16

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: e0fed8a672c59ba62f160e4114d2e28b2e400081
4
- data.tar.gz: 2c5d48eef8a2f71ab54a1c297b4959a39f2c11ce
2
+ SHA256:
3
+ metadata.gz: 040c365b1e70df2668c3c5ed37a799ae7c8962ec0d3d665f362937680f9b3d25
4
+ data.tar.gz: 8f35cd7f6e0a1cbf2c37017e073e212153efc21d668188e89c1113c4b0c46c89
5
5
  SHA512:
6
- metadata.gz: 5b687f855fbeb62b9012045fa408d222d016f8e9b5d14373d139b4262602ff9f0a96a5ee19dae8241c24cfdc33edb4981170feb821e2cda5b75b1edd33eb2c48
7
- data.tar.gz: 4532f6ef471e4f93fe415503c1609c0fed610544d9daa70b58c291931ec97c88d2b21860e59eaafd46a388591cf172515e2f28638dbc20c0a645070bc7ec150b
6
+ metadata.gz: 4c75ef9c84ea65e420ef42405ea4c743b33520fce54320a5700fa7e1d47b8ac4fea9ca2ceef9857ec35d7e07ffe12b353f76b5bd8e3127fc15302b948feb2ddb
7
+ data.tar.gz: 66a6626c91edfa67d0089e9eaadf62e6801b741ad5733b007be40be7668557b3d281b6fc5759a60606799c7ebf39fc5c164026333a5286c604ee5c74cb7d4bd3
data/README.md CHANGED
@@ -86,6 +86,7 @@ very large files aren't read into memory all at once.
86
86
  <table>
87
87
  <tr>
88
88
  <th>segments</th>
89
+ <th>2.5.0</th>
89
90
  <th>1.9.3</th>
90
91
  <th>1.9.2</th>
91
92
  <th>rbx-head</th>
@@ -93,6 +94,7 @@ very large files aren't read into memory all at once.
93
94
  </tr>
94
95
  <tr>
95
96
  <td>1680</td>
97
+ <td></td>
96
98
  <td>2107.90</td>
97
99
  <td>2007.17</td>
98
100
  <td>503.14</td>
@@ -100,6 +102,7 @@ very large files aren't read into memory all at once.
100
102
  </tr>
101
103
  <tr>
102
104
  <td>3360</td>
105
+ <td></td>
103
106
  <td>2461.54</td>
104
107
  <td>2420.75</td>
105
108
  <td>731.71</td>
@@ -107,6 +110,7 @@ very large files aren't read into memory all at once.
107
110
  </tr>
108
111
  <tr>
109
112
  <td>6720</td>
113
+ <td></td>
110
114
  <td>2677.29</td>
111
115
  <td>2620.90</td>
112
116
  <td>950.63</td>
@@ -114,6 +118,7 @@ very large files aren't read into memory all at once.
114
118
  </tr>
115
119
  <tr>
116
120
  <td>13440</td>
121
+ <td></td>
117
122
  <td>2699.88</td>
118
123
  <td>2663.50</td>
119
124
  <td>1071.00</td>
@@ -121,6 +126,7 @@ very large files aren't read into memory all at once.
121
126
  </tr>
122
127
  <tr>
123
128
  <td>26880</td>
129
+ <td></td>
124
130
  <td>2558.54</td>
125
131
  <td>2510.51</td>
126
132
  <td>1124.50</td>
@@ -128,6 +134,7 @@ very large files aren't read into memory all at once.
128
134
  </tr>
129
135
  <tr>
130
136
  <td>53760</td>
137
+ <td></td>
131
138
  <td>2254.94</td>
132
139
  <td>2164.16</td>
133
140
  <td>1039.81</td>
@@ -351,3 +358,8 @@ parser.first
351
358
  ```ruby
352
359
  rake spec
353
360
  ```
361
+
362
+ ### Run benchmarks
363
+ ```bash
364
+ notes/benchmark/bench.sh | ./notes/benchmark/fmt.rb
365
+ ```
data/bin/edi-pp CHANGED
@@ -1,6 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
2
  require File.expand_path("../../lib/stupidedi", __FILE__)
3
3
  require "pp"
4
+ require 'oj'
4
5
 
5
6
  # Short-lived processes should win some peformance gains here
6
7
  GC.disable
@@ -26,6 +27,8 @@ end
26
27
 
27
28
  stop = Time.now
28
29
 
30
+
31
+ test = []
29
32
  parser.zipper.map{|z| pp z.root.node }.explain do
30
33
  # Multiple parse trees (non-deterministic state)
31
34
  unless nondet
@@ -37,11 +40,18 @@ parser.zipper.map{|z| pp z.root.node }.explain do
37
40
  parser.active.each do |state|
38
41
  zipper = state.node.zipper
39
42
  pp zipper.root.node
40
- puts "\n#{"-" * 70}\n\n"
43
+
44
+ pp 'here'
45
+ puts "\n#{"-" * 70}\n\n"
41
46
  end
47
+
48
+
42
49
  end
43
50
  end
44
51
 
52
+
53
+
54
+
45
55
  begin
46
56
  a = parser.first
47
57
  b = parser.last
@@ -32,8 +32,12 @@ module Stupidedi
32
32
  state = zipper.node
33
33
  instructions = state.instructions.matches(segment_tok)
34
34
 
35
- if instructions.empty?
36
- active << zipper.append(FailureState.mksegment(segment_tok, state))
35
+ if instructions.empty?
36
+ if zipper.class == Stupidedi::Zipper::RootCursor
37
+ active << zipper.replace(FailureState.mksegment(segment_tok, state))
38
+ else
39
+ active << zipper.append(FailureState.mksegment(segment_tok, state))
40
+ end
37
41
  next
38
42
  end
39
43
 
@@ -58,11 +58,19 @@ module Stupidedi
58
58
  segment_val = Values::InvalidSegmentVal.new \
59
59
  "unexpected segment", segment_tok
60
60
 
61
- new(parent.separators,
62
- parent.segment_dict,
63
- parent.instructions,
64
- parent.zipper.append(segment_val),
65
- [])
61
+ if parent.zipper.class == Stupidedi::Zipper::RootCursor
62
+ new(parent.separators,
63
+ parent.segment_dict,
64
+ parent.instructions,
65
+ parent.zipper.replace(segment_val),
66
+ [])
67
+ else
68
+ new(parent.separators,
69
+ parent.segment_dict,
70
+ parent.instructions,
71
+ parent.zipper.append(segment_val),
72
+ [])
73
+ end
66
74
  end
67
75
 
68
76
  # @endgroup
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Stupidedi
4
- VERSION = "1.2.15"
4
+ VERSION = "1.2.16"
5
5
  end
@@ -281,7 +281,7 @@ module Stupidedi
281
281
  end
282
282
  end
283
283
 
284
- ansi.element("DT.value#{id}") << "(#{"%04d-%02d-%02d" % [year, month, day]})"
284
+ ansi.element("DT.value#{id}") + "(#{"%04d-%02d-%02d" % [year, month, day]})"
285
285
  end
286
286
 
287
287
  # @return [String]
@@ -462,7 +462,7 @@ module Stupidedi
462
462
  end
463
463
  end
464
464
 
465
- ansi.element("DT.value#{id}") << "(XX#{"%02d-%02d-%02d" % [@year, @month, @day]})"
465
+ ansi.element("DT.value#{id}") + "(XX#{"%02d-%02d-%02d" % [@year, @month, @day]})"
466
466
  end
467
467
 
468
468
  # @return [String]
@@ -239,7 +239,7 @@ module Stupidedi
239
239
  end
240
240
  end
241
241
 
242
- ansi.element("Nn.value#{id}") << "(#{to_s})"
242
+ ansi.element("Nn.value#{id}") + "(#{to_s})"
243
243
  end
244
244
 
245
245
  # @return [String]
@@ -231,7 +231,7 @@ module Stupidedi
231
231
  end
232
232
  end
233
233
 
234
- ansi.element(" R.value#{id}") << "(#{to_s})"
234
+ ansi.element(" R.value#{id}") + "(#{to_s})"
235
235
  end
236
236
 
237
237
  # @return [String]
@@ -262,7 +262,7 @@ module Stupidedi
262
262
  end
263
263
  end
264
264
 
265
- ansi.element("AN.value#{id}") << "(#{@value})"
265
+ ansi.element("AN.value#{id}") + "(#{@value})"
266
266
  end
267
267
 
268
268
  def valid?
@@ -226,7 +226,7 @@ module Stupidedi
226
226
  mm = @minute.try{|m| "%02d" % m } || "mm"
227
227
  ss = @second.try{|s| s.to_s("F") } || "ss"
228
228
 
229
- ansi.element("TM.value#{id}") << "(#{hh}:#{mm}:#{ss})"
229
+ ansi.element("TM.value#{id}") + "(#{hh}:#{mm}:#{ss})"
230
230
  end
231
231
 
232
232
  # @return [String]
@@ -98,7 +98,7 @@ module Stupidedi
98
98
 
99
99
  def inspect
100
100
  id = definition.try{|d| ansi.bold("[#{d.id}]") }
101
- ansi.element("SeparatorElementVal.value#{id}") << "(#{@value || "nil"})"
101
+ ansi.element("SeparatorElementVal.value#{id}") + "(#{@value || "nil"})"
102
102
  end
103
103
  end
104
104
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: stupidedi
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.15
4
+ version: 1.2.16
5
5
  platform: ruby
6
6
  authors:
7
- - Kyle Putnam
7
+ - Kyle Putnam/Isi Robayna
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-12-20 00:00:00.000000000 Z
11
+ date: 2018-05-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: term-ansicolor
@@ -28,18 +28,18 @@ dependencies:
28
28
  name: cantor
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - '='
31
+ - - "~>"
32
32
  - !ruby/object:Gem::Version
33
33
  version: 1.2.1
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - '='
38
+ - - "~>"
39
39
  - !ruby/object:Gem::Version
40
40
  version: 1.2.1
41
41
  description: Ruby API for parsing and generating ASC X12 EDI transactions
42
- email: putnam.kyle@gmail.com
42
+ email: irobayna@gmail.com
43
43
  executables:
44
44
  - edi-pp
45
45
  - edi-ed
@@ -1189,7 +1189,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
1189
1189
  version: '0'
1190
1190
  requirements: []
1191
1191
  rubyforge_project:
1192
- rubygems_version: 2.6.13
1192
+ rubygems_version: 2.7.6
1193
1193
  signing_key:
1194
1194
  specification_version: 4
1195
1195
  summary: Parse, generate, validate ASC X12 EDI