stupidedi 1.2.11 → 1.2.12

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
2
  SHA1:
3
- metadata.gz: 949d22354fedb76e7e6c84d7b12880226c06addf
4
- data.tar.gz: 460a656ce3aae6d328279bfdcec2be88aa4d237f
3
+ metadata.gz: c6c79cf377cf10c26a069203de16a7490729b691
4
+ data.tar.gz: 4f979f9cd4ce79ef213119eea58cf12aea4463c7
5
5
  SHA512:
6
- metadata.gz: c1360abeb0ed7e5d89f2fa5c93507a5bb83e65aba7e409dbecda0c4f83c017c7816512211b2c904606f4171fe6a0379b97257b6b8059764c25c01a9e447377cb
7
- data.tar.gz: 0df5aa480daf106577c3bc95e9b30e5d5bc2f5bf7f5becabdab874c819ce80c4d526eab751e1f5f8b483f1611495d085bd4f666929fd9ae2cc65ac7fa24a68bd
6
+ metadata.gz: 1702828adf1d45725d4b8b6c8ac526f8131e7e32765c9c1675e064318a3c7048e999bf5bccc21142b0e4b52dbad683ed7aa9ed23785d144342a30c2655c443db
7
+ data.tar.gz: 7fec90e6d0a3c98104c37ff927d85632a02513215c0086639340bb703db38ba01ef9f41b61ade8cc1a398beef6efda1eff55faecd7ea4067e5b539a68e261898
@@ -126,7 +126,7 @@ module Stupidedi
126
126
  else
127
127
  if strict
128
128
  designator = "#{segment_tok.id}#{'%02d' % (n + 1)}"
129
- designator << "-%02d" % m unless m.nil?
129
+ designator = designator + "-%02d" % m unless m.nil?
130
130
 
131
131
  raise ArgumentError,
132
132
  "#{value.inspect} is not allowed in #{designator}"
@@ -160,7 +160,7 @@ module Stupidedi
160
160
  else
161
161
  if strict
162
162
  designator = "#{segment_tok.id}#{'%02d' % n}"
163
- designator << "-%02d" % m unless m.nil?
163
+ designator = designator + "-%02d" % m unless m.nil?
164
164
 
165
165
  raise ArgumentError,
166
166
  "#{value.inspect} is not allowed in #{designator}"
@@ -77,9 +77,9 @@ module Stupidedi
77
77
 
78
78
  # Truncate the segment name to `width` characters
79
79
  if name.length > width - 2
80
- id << ": #{name.slice(0, width - 2)}.."
80
+ id = id + ": #{name.slice(0, width - 2)}.."
81
81
  else
82
- id << ": #{name.ljust(width)}"
82
+ id = id + ": #{name.ljust(width)}"
83
83
  end
84
84
  end
85
85
 
@@ -142,7 +142,7 @@ module Stupidedi
142
142
  "#{designator} segment has only #{length} elements"
143
143
  end
144
144
 
145
- designator << "%02d" % m
145
+ designator = designator + "%02d" % m
146
146
  value = s.child(m - 1)
147
147
 
148
148
  if n.nil?
@@ -22,7 +22,7 @@ module Stupidedi
22
22
  "#<\#<Class:0x#{self.class.object_id.abs.to_s(16)}>"
23
23
  else
24
24
  "#<#{self.class.name}"
25
- end << ":0x#{object_id.abs.to_s(16)} ...>"
25
+ end + ":0x#{object_id.abs.to_s(16)} ...>"
26
26
  end
27
27
  end
28
28
 
@@ -93,7 +93,7 @@ module Stupidedi
93
93
  elsif preview.length <= 3
94
94
  preview.inspect
95
95
  else
96
- (preview.take(3) << "...").inspect
96
+ (preview.take(3) + "...").inspect
97
97
  end
98
98
 
99
99
  q.text preview
@@ -73,7 +73,7 @@ module Stupidedi
73
73
 
74
74
  until @io.eof?
75
75
  buffer.slice!(0)
76
- buffer << @io.read(1)
76
+ buffer = buffer + @io.read(1)
77
77
 
78
78
  if buffer == value
79
79
  return @io.tell - @offset - length
@@ -133,7 +133,7 @@ module Stupidedi
133
133
  elsif preview.length <= 3
134
134
  preview.inspect
135
135
  else
136
- (preview.take(3) << "...").inspect
136
+ (preview.take(3) + "...").inspect
137
137
  end
138
138
 
139
139
  q.text preview
@@ -138,9 +138,8 @@ module Stupidedi
138
138
 
139
139
  unless Reader.is_control_character?(character)
140
140
  # Slide the "window" forward one character
141
- # buffer = buffer.slice!(1..-1) << character.upcase
142
141
  buffer = buffer.slice(1..-1)
143
- buffer = buffer << character.upcase
142
+ buffer = buffer + character.upcase
144
143
  if buffer == "ISA"
145
144
  return success(advance(position))
146
145
  end
@@ -64,7 +64,6 @@ module Stupidedi
64
64
  position += 1
65
65
 
66
66
  unless is_control?(character)
67
- # buffer << character
68
67
  buffer = buffer + character
69
68
 
70
69
  if s.length == buffer.length
@@ -110,7 +109,7 @@ module Stupidedi
110
109
 
111
110
  unless is_control?(character)
112
111
  # Slide the "window" forward one character
113
- buffer = buffer.slice(1..-1) << character
112
+ buffer = buffer.slice(1..-1) + character
114
113
  end
115
114
 
116
115
  position += 1
@@ -258,7 +257,6 @@ module Stupidedi
258
257
  break
259
258
  end
260
259
 
261
- # buffer << character
262
260
  buffer = buffer + character
263
261
  end
264
262
  end
@@ -337,7 +335,6 @@ module Stupidedi
337
335
  # # @todo: Read this as data but sound the alarms
338
336
  end
339
337
 
340
- # buffer << character
341
338
  buffer = buffer + character
342
339
  end
343
340
 
@@ -374,7 +371,6 @@ module Stupidedi
374
371
  end
375
372
  end
376
373
 
377
- # buffer << character
378
374
  buffer = buffer + character
379
375
  end
380
376
 
@@ -39,7 +39,6 @@ module Stupidedi
39
39
 
40
40
  # @private
41
41
  # @return [String]
42
- # C_BYTES = (0..255).inject(""){|string, c| string << c }.freeze
43
42
  C_BYTES = (0..255).inject(""){|string, c| string + [c].pack('U') }
44
43
 
45
44
  # @private
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Stupidedi
4
- VERSION = "1.2.11"
4
+ VERSION = "1.2.12"
5
5
  end
@@ -257,10 +257,10 @@ module Stupidedi
257
257
  # Leading zeros must be suppressed unless necessary to satisfy a
258
258
  # minimum length requirement
259
259
  if truncate
260
- sign << nn.abs.to_s.take(definition.max_length).
260
+ sign = sign + nn.abs.to_s.take(definition.max_length).
261
261
  rjust(definition.min_length, "0")
262
262
  else
263
- sign << nn.abs.to_s.rjust(definition.min_length, "0")
263
+ sign = sign + nn.abs.to_s.rjust(definition.min_length, "0")
264
264
  end
265
265
  end
266
266
 
@@ -261,7 +261,8 @@ module Stupidedi
261
261
  if truncate
262
262
  int = @value.to_i.to_s
263
263
  sign = (int < 0) ? "-" : ""
264
- return sign << int.abs.to_s.take(definition.max_length)
264
+ sign = sign + int.abs.to_s.take(definition.max_length)
265
+ return sign
265
266
  else
266
267
  return @value.to_i.abs
267
268
  end
@@ -196,8 +196,8 @@ module Stupidedi
196
196
  # @return [BigDecimal]
197
197
  attr_reader :value
198
198
 
199
- def_delegators :@value, :to_i, :to_d, :to_f, :to_r, :to_c
200
-
199
+ def_delegators :@value, :to_i, :to_d, :to_f, :to_r, :to_c
200
+
201
201
  def initialize(value, usage, position)
202
202
  @value = value
203
203
  super(usage, position)
@@ -256,10 +256,10 @@ module Stupidedi
256
256
  # Leading zeros must be suppressed unless necessary to satisfy a
257
257
  # minimum length requirement
258
258
  if truncate
259
- sign << nn.abs.to_s.take(definition.max_length).
259
+ sign = sign + nn.abs.to_s.take(definition.max_length).
260
260
  rjust(definition.min_length, "0")
261
261
  else
262
- sign << nn.abs.to_s.rjust(definition.min_length, "0")
262
+ sign = sign + nn.abs.to_s.rjust(definition.min_length, "0")
263
263
  end
264
264
  end
265
265
 
@@ -185,9 +185,9 @@ module Stupidedi
185
185
  # @return [BigDecimal]
186
186
  attr_reader :value
187
187
 
188
- def_delegators :@value, :to_i, :to_d, :to_f, :to_r, :to_c
188
+ def_delegators :@value, :to_i, :to_d, :to_f, :to_r, :to_c
189
+
189
190
 
190
-
191
191
  def initialize(value, usage, position)
192
192
  @value = value
193
193
  super(usage, position)
@@ -262,7 +262,8 @@ module Stupidedi
262
262
  if truncate
263
263
  int = @value.to_i.to_s
264
264
  sign = (int < 0) ? "-" : ""
265
- return sign << int.abs.to_s.take(definition.max_length)
265
+ sign = sign + int.abs.to_s.take(definition.max_length)
266
+ return sign
266
267
  else
267
268
  return @value.to_i.abs
268
269
  end
@@ -197,8 +197,8 @@ module Stupidedi
197
197
  attr_reader :value
198
198
 
199
199
  def_delegators :@value, :to_i, :to_d, :to_f, :to_r, :to_c
200
-
201
-
200
+
201
+
202
202
  def initialize(value, usage, position)
203
203
  @value = value
204
204
  super(usage, position)
@@ -257,10 +257,10 @@ module Stupidedi
257
257
  # Leading zeros must be suppressed unless necessary to satisfy a
258
258
  # minimum length requirement
259
259
  if truncate
260
- sign << nn.abs.to_s.take(definition.max_length).
260
+ sign = sign + nn.abs.to_s.take(definition.max_length).
261
261
  rjust(definition.min_length, "0")
262
262
  else
263
- sign << nn.abs.to_s.rjust(definition.min_length, "0")
263
+ sign = sign + nn.abs.to_s.rjust(definition.min_length, "0")
264
264
  end
265
265
  end
266
266
 
@@ -186,9 +186,9 @@ module Stupidedi
186
186
  attr_reader :value
187
187
 
188
188
  def_delegators :@value, :to_i, :to_d, :to_f, :to_r, :to_c
189
-
190
189
 
191
-
190
+
191
+
192
192
  def initialize(value, usage, position)
193
193
  @value = value
194
194
  super(usage, position)
@@ -263,7 +263,8 @@ module Stupidedi
263
263
  if truncate
264
264
  int = @value.to_i.to_s
265
265
  sign = (int < 0) ? "-" : ""
266
- return sign << int.abs.to_s.take(definition.max_length)
266
+ sign = sign + int.abs.to_s.take(definition.max_length)
267
+ return sign
267
268
  else
268
269
  return @value.to_i.abs
269
270
  end
@@ -257,8 +257,6 @@ module Stupidedi
257
257
  # Leading zeros must be suppressed unless necessary to satisfy a
258
258
  # minimum length requirement
259
259
  if truncate
260
- # sign << nn.abs.to_s.take(definition.max_length).
261
- # rjust(definition.min_length, "0")
262
260
  sign = sign + nn.abs.to_s.take(definition.max_length).
263
261
  rjust(definition.min_length, "0")
264
262
  else
@@ -264,7 +264,6 @@ module Stupidedi
264
264
  sign = (int < 0) ? "-" : ""
265
265
  sign = sign + int.abs.to_s.take(definition.max_length)
266
266
  return sign
267
- # return sign << int.abs.to_s.take(definition.max_length)
268
267
  else
269
268
  return @value.to_i.abs
270
269
  end
@@ -256,12 +256,9 @@ module Stupidedi
256
256
  # Leading zeros must be suppressed unless necessary to satisfy a
257
257
  # minimum length requirement
258
258
  if truncate
259
- # sign << nn.abs.to_s.take(definition.max_length).
260
- # rjust(definition.min_length, "0")
261
259
  sign = sign + nn.abs.to_s.take(definition.max_length).
262
260
  rjust(definition.min_length, "0")
263
261
  else
264
- # sign << nn.abs.to_s.rjust(definition.min_length, "0")
265
262
  sign = sign + nn.abs.to_s.rjust(definition.min_length, "0")
266
263
  end
267
264
  end
@@ -186,9 +186,9 @@ module Stupidedi
186
186
  attr_reader :value
187
187
 
188
188
  def_delegators :@value, :to_i, :to_d, :to_f, :to_r, :to_c
189
-
190
189
 
191
-
190
+
191
+
192
192
  def initialize(value, usage, position)
193
193
  @value = value
194
194
  super(usage, position)
@@ -263,7 +263,8 @@ module Stupidedi
263
263
  if truncate
264
264
  int = @value.to_i.to_s
265
265
  sign = (int < 0) ? "-" : ""
266
- return sign << int.abs.to_s.take(definition.max_length)
266
+ sign = sign + int.abs.to_s.take(definition.max_length)
267
+ return sign
267
268
  else
268
269
  return @value.to_i.abs
269
270
  end
@@ -12,9 +12,9 @@ module Stupidedi
12
12
 
13
13
  # @return [String]
14
14
  def write(out = "")
15
- out << "<html><head>\n#{style}</head>\n<body>\n"
15
+ out = out + "<html><head>\n#{style}</head>\n<body>\n"
16
16
  build(@node, out)
17
- out << "</body></html>"
17
+ out + "</body></html>"
18
18
  end
19
19
 
20
20
  private
@@ -81,62 +81,62 @@ module Stupidedi
81
81
  if node.element?
82
82
 
83
83
  if node.composite?
84
- out << "*"
84
+ out = out + "*"
85
85
  tmp = ""
86
86
  node.children.each{|e| build(e, tmp) }
87
87
  tmp = tmp.gsub(/:*$/, "")
88
- out << tmp
88
+ out + tmp
89
89
  elsif node.component?
90
- out << "#{node}:"
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 << "*#{node}"
95
+ out + "*#{node}"
96
96
  end
97
97
 
98
98
  elsif node.segment?
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"
99
+ out = out + "<div class=segment><div class=label title='#{node.definition.name}'>"
100
+ out = out + '% 3s' % node.definition.id
101
+ # out = out + ": #{node.definition.name}</div></div>\n"
102
102
  tmp = ""
103
103
  node.children.each{|e| build(e, tmp) }
104
104
  tmp = tmp.gsub(/\**$/, "")
105
- out << "#{tmp}~</div></div>\n"
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 << "<div class=loop><div class=label>#{name} (#{id})</div>\n"
112
+ out = out + "<div class=loop><div class=label>#{name} (#{id})</div>\n"
113
113
  node.children.each{|c| build(c, out) }
114
- out << "</div>\n"
114
+ out + "</div>\n"
115
115
 
116
116
  elsif node.table?
117
- out << "<div class=table><div class=label>#{node.definition.id}</div>\n"
117
+ out = out + "<div class=table><div class=label>#{node.definition.id}</div>\n"
118
118
  node.children.each{|c| build(c, out) }
119
- out << "</div>\n"
119
+ out + "</div>\n"
120
120
 
121
121
  elsif node.transaction_set?
122
- out << "<div class=transaction><div class=label>Transaction Set #{node.definition.id}</div>\n"
122
+ out = 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 << "</div>\n"
124
+ out + "</div>\n"
125
125
 
126
126
  elsif node.functional_group?
127
- out << "<div class=functionalgr><div class=label>Functional Group #{node.definition.id}</div>\n"
127
+ out = 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 << "</div>\n"
129
+ out + "</div>\n"
130
130
 
131
131
  elsif node.interchange?
132
- out << "<div class=interchange><div class=label>Interchange #{node.definition.id}</div>\n"
132
+ out = out + "<div class=interchange><div class=label>Interchange #{node.definition.id}</div>\n"
133
133
  node.children.each{|c| build(c, out) }
134
- out << "</div>\n"
134
+ out + "</div>\n"
135
135
 
136
136
  elsif node.transmission?
137
- out << "<div class=transmission>\n"
137
+ out = out + "<div class=transmission>\n"
138
138
  node.children.each{|c| build(c, out) }
139
- out << "</div>\n"
139
+ out + "</div>\n"
140
140
  end
141
141
  end
142
142
  end
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.11
4
+ version: 1.2.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kyle Putnam