rbedi 0.0.0 → 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/edi +897 -0
- data/lib/rbedi/codes/aaa.rb +437 -0
- data/lib/rbedi/codes/ak1.rb +278 -0
- data/lib/rbedi/codes/ak2.rb +336 -0
- data/lib/rbedi/codes/ak9.rb +55 -0
- data/lib/rbedi/codes/bht.rb +706 -0
- data/lib/rbedi/codes/codeset.rb +27 -0
- data/lib/rbedi/codes/dmg.rb +1583 -0
- data/lib/rbedi/codes/dtp.rb +1342 -0
- data/lib/rbedi/codes/eb.rb +1511 -0
- data/lib/rbedi/codes/eq.rb +286 -0
- data/lib/rbedi/codes/ge.rb +14 -0
- data/lib/rbedi/codes/gs.rb +287 -0
- data/lib/rbedi/codes/hl.rb +273 -0
- data/lib/rbedi/codes/iea.rb +14 -0
- data/lib/rbedi/codes/ik3.rb +32 -0
- data/lib/rbedi/codes/ik4.rb +37 -0
- data/lib/rbedi/codes/ik5.rb +56 -0
- data/lib/rbedi/codes/isa.rb +137 -0
- data/lib/rbedi/codes/le.rb +13 -0
- data/lib/rbedi/codes/ls.rb +13 -0
- data/lib/rbedi/codes/msg.rb +25 -0
- data/lib/rbedi/codes/n3.rb +14 -0
- data/lib/rbedi/codes/n4.rb +706 -0
- data/lib/rbedi/codes/nm1.rb +1916 -0
- data/lib/rbedi/codes/per.rb +308 -0
- data/lib/rbedi/codes/ref.rb +1749 -0
- data/lib/rbedi/codes/se.rb +14 -0
- data/lib/rbedi/codes/segment_names.rb +44 -0
- data/lib/rbedi/codes/st.rb +336 -0
- data/lib/rbedi/codes/trn.rb +22 -0
- data/lib/rbedi/codes.rb +8 -0
- data/lib/rbedi/edi_date_time.rb +69 -0
- data/lib/rbedi/functional_group.rb +52 -0
- data/lib/rbedi/non_existent_element_error.rb +4 -0
- data/lib/rbedi/parser.rb +102 -0
- data/lib/rbedi/segment.rb +114 -0
- data/lib/rbedi/transaction_envelope.rb +77 -0
- data/lib/rbedi/transaction_set.rb +40 -0
- data/lib/rbedi.rb +20 -4
- metadata +79 -10
@@ -0,0 +1,27 @@
|
|
1
|
+
module RBEDI
|
2
|
+
module Codes
|
3
|
+
module CodeSet
|
4
|
+
def segment_position(pos)
|
5
|
+
if pos.is_a?(Integer)
|
6
|
+
self::SEGMENT_POSITIONS[pos]
|
7
|
+
else
|
8
|
+
self::SEGMENT_POSITIONS.key(pos)
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
def code(pos, code)
|
13
|
+
pos = self::SEGMENT_POSITIONS.key(pos) unless pos.is_a?(Integer)
|
14
|
+
codes = self::CODES[pos]
|
15
|
+
|
16
|
+
return nil unless codes
|
17
|
+
return nil if code.nil?
|
18
|
+
|
19
|
+
if code.is_a?(String)
|
20
|
+
codes[code.downcase]
|
21
|
+
else
|
22
|
+
codes.key(code).upcase
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|