x12-lite 0.3.1 → 0.3.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/lib/x12-lite.rb +23 -23
  3. metadata +2 -3
  4. data/x12-lite-0.3.0.gem +0 -0
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 52b48b455f3607ad7b3deef332c22b8c7d1840177feac0937aa56225741fbc9c
4
- data.tar.gz: e8e4a308eb587b706cee710cd18ab9ba2ca46948e3d7836621257455cd06ce46
3
+ metadata.gz: c0dda270782d3da6aa8372f5e723020f80307bb7b79863adad4395f37181d6ea
4
+ data.tar.gz: 07f4bd9ff342f3e1a10744eed0ddc1e457002f2d7b997acbe6e13aaa852cb153
5
5
  SHA512:
6
- metadata.gz: 737885ebe9240efa6728ccecaec31b27253e823872d6cec08bec933dd4757efa3951af9423546d24bf9bae2bebb7d1ce9cf383babc4a415496e6548189535cd3
7
- data.tar.gz: ce07efaf033c829ce0ba0020875f936cef3b75ca37bfe79a4b8e483d62cc1834c0c9f98ce35bffb767c4f8e98b480ea4442996461d91f392d99caf05e6537fec
6
+ metadata.gz: 4bb1cfab0e81e8ac3ac4ef44908502480287f4d93fab64d3447d01770fdade114d706c99df7a8085f35f46dac9bf1cd2c7e44bb5236c594d867f69b922221903
7
+ data.tar.gz: ac5eca285b4671120d79dbeed83502ef8959501344d8a1575ea97954194256c72593b99e1ad21e17dc6df104808bfe60fd3305009530cb579800d927240562c3
data/lib/x12-lite.rb CHANGED
@@ -45,7 +45,7 @@ end
45
45
  # ==[ X12 ]=====================================================================
46
46
 
47
47
  class X12
48
- VERSION="0.3.1"
48
+ VERSION="0.3.3"
49
49
 
50
50
  include Enumerable
51
51
 
@@ -183,7 +183,7 @@ class X12
183
183
  end
184
184
  end
185
185
  tag = "#{seg}%s-#{j}" % [num > 1 && !only ? "(#{num})" : ""]
186
- out << (tag.ljust(left) + wrap(fld, "fff", "369"))
186
+ out << (tag.ljust(left) + ansi(fld, "fff", "369"))
187
187
  end
188
188
  end
189
189
  end
@@ -368,27 +368,27 @@ class X12
368
368
  self
369
369
  end
370
370
 
371
- # def each(seg=nil)
372
- # to_a.each do |item|
373
- # next if seg && !(seg === item[0])
374
- # yield item
375
- # end
376
- # end
377
- #
378
- # # means this each may change @ary, so clear @str in case
379
- # def each!(...)
380
- # out = each(...)
381
- # @str &&= nil
382
- # out
383
- # end
384
- #
385
- # def grep(who)
386
- # inject([]) do |ary, row|
387
- # ary.push(block_given? ? yield(row) : row) if who === row.first
388
- # ary
389
- # end
390
- # end
391
- #
371
+ def each(seg=nil)
372
+ to_a.each do |row|
373
+ next if seg && !(seg === row.first)
374
+ yield row
375
+ end
376
+ end
377
+
378
+ # means this each may change @ary, so clear @str in case
379
+ def each!(...)
380
+ out = each(...)
381
+ @str &&= nil
382
+ out
383
+ end
384
+
385
+ def grep(seg)
386
+ reduce([]) do |ary, row|
387
+ ary.push(block_given? ? yield(row) : row) if seg === row.first
388
+ ary
389
+ end
390
+ end
391
+
392
392
  # def now(fmt="%Y%m%d%H%M%S")
393
393
  # Time.now.strftime(fmt)
394
394
  # end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: x12-lite
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.3.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Steve Shreeve
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-10-10 00:00:00.000000000 Z
11
+ date: 2024-10-15 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Ruby gem to parse and generate X.12 transactions
14
14
  email: steve.shreeve@gmail.com
@@ -22,7 +22,6 @@ files:
22
22
  - README.md
23
23
  - bin/x12
24
24
  - lib/x12-lite.rb
25
- - x12-lite-0.3.0.gem
26
25
  - x12-lite.gemspec
27
26
  homepage: https://github.com/shreeve/x12-lite
28
27
  licenses:
data/x12-lite-0.3.0.gem DELETED
Binary file