x12-lite 0.3.2 → 0.3.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/bin/x12 +5 -5
- data/lib/x12-lite.rb +23 -23
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 799f8972aee25c85647594ce69dc8131db01fb452e640fe37e433ca4cbc0bbdc
|
4
|
+
data.tar.gz: d330647f6c9a9c3e93505eea924ae050e5ebdf87862c0490c8484f14c34ce03c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
-
|
33
|
-
|
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
|
-
|
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
|
-
|
67
|
-
|
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
|
+
# 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.
|
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
|
-
|
372
|
-
|
373
|
-
|
374
|
-
|
375
|
-
|
376
|
-
|
377
|
-
|
378
|
-
#
|
379
|
-
|
380
|
-
|
381
|
-
|
382
|
-
|
383
|
-
|
384
|
-
|
385
|
-
|
386
|
-
|
387
|
-
|
388
|
-
|
389
|
-
|
390
|
-
|
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.
|
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-
|
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
|