x12-lite 0.3.2 → 0.3.4

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/bin/x12 +5 -5
  3. data/lib/x12-lite.rb +23 -23
  4. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e8d4f7517a48b4d459c504acd82cd03026d9ce92d9ac050358806d99079f63ec
4
- data.tar.gz: c94c80e10ffae8aaa0919d6a48301229ff64fc0e6fabda94d70c153700c5ca1c
3
+ metadata.gz: 799f8972aee25c85647594ce69dc8131db01fb452e640fe37e433ca4cbc0bbdc
4
+ data.tar.gz: d330647f6c9a9c3e93505eea924ae050e5ebdf87862c0490c8484f14c34ce03c
5
5
  SHA512:
6
- metadata.gz: a6a165012d316612f5271b3a4c9be843b96ff3726c85b54500b0ebd178c14a55af88d4a0497c811e5680f7133c0bd6ebac40e3f2a9d22871bfc51787c8bfe37c
7
- data.tar.gz: d3151ad5b56cb3fa01434b0771cda436c2c131e1ee5ef6edf507f0447a6d95de28694d688ad5efc1047bfe2864ab257a1f0ff5ad4d19a36ff21b5c47a607a921
6
+ metadata.gz: 8fb8a2e3a46c591d2ee974d3cc6ad1bac7ce0ec068e57e941bbbe210beee7a7fe389f6e91271da5fc74c5b7c8658a831412e9feb19adc920bdceb548fdaa39f0
7
+ data.tar.gz: ade6170411ca06dac5510d65c561791faf49fc4285e43bc3d6bded693d951ff16575288150d1e9fc4ddcf5d02339a32b7b257cc29c0054091156dd2d7b68f092
data/bin/x12 CHANGED
@@ -29,8 +29,8 @@ OptionParser.new.instance_eval do
29
29
  on "-c", "--count" , "Count messages at the end"
30
30
  on "-d", "--dive" , "Dive into directories recursively"
31
31
  # on "--delim <char>" , "Delimiter to use"
32
- # on "-f", "--fields" , "Show fields"
33
- # on "-F", "--fields-only" , "Show fields only, not repeat indicators"
32
+ on "-f", "--fields" , "Show fields"
33
+ on "-F", "--fields-only" , "Show fields only, not repeat indicators"
34
34
  on "-h", "--help" , "Show help and command usage" do Kernel.abort to_s; end
35
35
  on "-i", "--ignore" , "Ignore malformed X12 files"
36
36
  on "-l", "--lower" , "Show segment names in lowercase"
@@ -53,7 +53,7 @@ require "time" if opts["after"]
53
53
 
54
54
  time = Time.parse(opts["after"]) if opts["after"]
55
55
  dive = opts["dive"]
56
- # only = opts["fields-only"] and opts["fields"] = true
56
+ only = opts["fields-only"] and opts["fields"] = true
57
57
  # quer = opts["query"].split(',').map(&:strip) if opts["query"]
58
58
  # from = quer.delete("-") if quer.is_a?(Array)
59
59
  # delm = opts["tsv"] ? "\t" : (opts["delim"] || "|")
@@ -63,8 +63,8 @@ args = []
63
63
  # args << :deep if opts["repeats"]
64
64
  args << :down if opts["lower"]
65
65
  args << :full if opts["message"] || opts.empty?
66
- # args << :hide if !opts["fields"]
67
- # args << :only if only
66
+ args << :hide if !opts["fields"]
67
+ args << :only if only
68
68
  # args << (opts["width"].to_i.between?(1, 50) ? opts["width"].to_i : 12) if opts["width"]
69
69
 
70
70
  msgs = 0
data/lib/x12-lite.rb CHANGED
@@ -4,7 +4,7 @@
4
4
  # x12-lite.rb: X12 library for Ruby
5
5
  #
6
6
  # Author: Steve Shreeve <steve.shreeve@gmail.com>
7
- # Date: October 7, 2024
7
+ # Date: October 16, 2024
8
8
  #
9
9
  # Legal: All rights reserved.
10
10
  # ==============================================================================
@@ -45,7 +45,7 @@ end
45
45
  # ==[ X12 ]=====================================================================
46
46
 
47
47
  class X12
48
- VERSION="0.3.2"
48
+ VERSION="0.3.4"
49
49
 
50
50
  include Enumerable
51
51
 
@@ -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.2
4
+ version: 0.3.4
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-14 00:00:00.000000000 Z
11
+ date: 2024-10-17 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