Module: RBEDI::Codes::CodeSet

Included in:
AAA, AK1, AK2, AK9, BHT, DMG, DTP, EB, EQ, GE, GS, HL, IEA, IK3, IK4, IK5, ISA, LE, LS, MSG, N3, N4, NM1, PER, REF, SE, ST, TRN
Defined in:
lib/rbedi/codes/codeset.rb

Instance Method Summary collapse

Instance Method Details

#code(pos, code) ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/rbedi/codes/codeset.rb', line 12

def code(pos, code)
  pos = self::SEGMENT_POSITIONS.key(pos) unless pos.is_a?(Integer)
  codes = self::CODES[pos]

  return nil unless codes
  return nil if code.nil?

  if code.is_a?(String)
    codes[code.downcase]
  else
    codes.key(code).upcase
  end
end

#segment_position(pos) ⇒ Object



4
5
6
7
8
9
10
# File 'lib/rbedi/codes/codeset.rb', line 4

def segment_position(pos)
  if pos.is_a?(Integer)
    self::SEGMENT_POSITIONS[pos]
  else
    self::SEGMENT_POSITIONS.key(pos)
  end
end