Class: Codec::Ascii
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
Methods inherited from Base
#add_sub_codec, #decode, #decode_with_length, #encode_with_length, #eval_length, #get_length, #get_sub_codecs, #initialize
Constructor Details
This class inherits a constructor from Codec::Base
Instance Method Details
#build_field(buf, length) ⇒ Object
98 99 100 101 102 |
# File 'lib/codec/fix.rb', line 98 def build_field(buf,length) f = Field.new(@id) f.set_value(EightBitsEncoding::ASCII_2_UTF8(buf[0,length])) return f end |
#encode(f) ⇒ Object
104 105 106 107 108 109 110 111 |
# File 'lib/codec/fix.rb', line 104 def encode(f) out = f.get_value if @length > 0 raise TooLongDataException if out.length > @length out = out.ljust(@length," ") end return EightBitsEncoding::UTF8_2_ASCII(out) end |