Class: Codec::Ebcdic
Instance Method Summary collapse
Methods inherited from Fix
#check_length, #decode, #initialize
Methods inherited from Base
#add_sub_codec, #decode, #get_sub_codecs
Constructor Details
This class inherits a constructor from Codec::Fix
Instance Method Details
#build_field(buf, f, length) ⇒ Object
106 107 108 |
# File 'lib/codec/fix.rb', line 106 def build_field(buf, f, length) f.set_value(EightBitsEncoding::EBCDIC_2_UTF8(buf.slice!(0...length))) end |
#encode(buf, f) ⇒ Object
110 111 112 113 114 115 116 117 118 |
# File 'lib/codec/fix.rb', line 110 def encode(buf, f) out = f.get_value if @length > 0 raise TooLongDataException if out.length > @length out = out.ljust(@length," ") end buf << EightBitsEncoding::UTF8_2_EBCDIC(out) return out.length end |