Class: Codec::Ascii
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
122 123 124 |
# File 'lib/codec/fix.rb', line 122 def build_field(buf, f, length) f.set_value(EightBitsEncoding::ASCII_2_UTF8(buf.slice!(0...length))) end |
#encode(buf, f) ⇒ Object
126 127 128 129 130 131 132 133 134 |
# File 'lib/codec/fix.rb', line 126 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_ASCII(out) return out.length end |