rbedi 0.0.0 → 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (42) hide show
  1. checksums.yaml +4 -4
  2. data/bin/edi +897 -0
  3. data/lib/rbedi/codes/aaa.rb +437 -0
  4. data/lib/rbedi/codes/ak1.rb +278 -0
  5. data/lib/rbedi/codes/ak2.rb +336 -0
  6. data/lib/rbedi/codes/ak9.rb +55 -0
  7. data/lib/rbedi/codes/bht.rb +706 -0
  8. data/lib/rbedi/codes/codeset.rb +27 -0
  9. data/lib/rbedi/codes/dmg.rb +1583 -0
  10. data/lib/rbedi/codes/dtp.rb +1342 -0
  11. data/lib/rbedi/codes/eb.rb +1511 -0
  12. data/lib/rbedi/codes/eq.rb +286 -0
  13. data/lib/rbedi/codes/ge.rb +14 -0
  14. data/lib/rbedi/codes/gs.rb +287 -0
  15. data/lib/rbedi/codes/hl.rb +273 -0
  16. data/lib/rbedi/codes/iea.rb +14 -0
  17. data/lib/rbedi/codes/ik3.rb +32 -0
  18. data/lib/rbedi/codes/ik4.rb +37 -0
  19. data/lib/rbedi/codes/ik5.rb +56 -0
  20. data/lib/rbedi/codes/isa.rb +137 -0
  21. data/lib/rbedi/codes/le.rb +13 -0
  22. data/lib/rbedi/codes/ls.rb +13 -0
  23. data/lib/rbedi/codes/msg.rb +25 -0
  24. data/lib/rbedi/codes/n3.rb +14 -0
  25. data/lib/rbedi/codes/n4.rb +706 -0
  26. data/lib/rbedi/codes/nm1.rb +1916 -0
  27. data/lib/rbedi/codes/per.rb +308 -0
  28. data/lib/rbedi/codes/ref.rb +1749 -0
  29. data/lib/rbedi/codes/se.rb +14 -0
  30. data/lib/rbedi/codes/segment_names.rb +44 -0
  31. data/lib/rbedi/codes/st.rb +336 -0
  32. data/lib/rbedi/codes/trn.rb +22 -0
  33. data/lib/rbedi/codes.rb +8 -0
  34. data/lib/rbedi/edi_date_time.rb +69 -0
  35. data/lib/rbedi/functional_group.rb +52 -0
  36. data/lib/rbedi/non_existent_element_error.rb +4 -0
  37. data/lib/rbedi/parser.rb +102 -0
  38. data/lib/rbedi/segment.rb +114 -0
  39. data/lib/rbedi/transaction_envelope.rb +77 -0
  40. data/lib/rbedi/transaction_set.rb +40 -0
  41. data/lib/rbedi.rb +20 -4
  42. 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