Class: Codec::String
Direct Known Subclasses
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
116 117 118 119 120 |
# File 'lib/codec/fix.rb', line 116 def build_field(buf,length) f = Field.new(@id) f.set_value(buf[0,length]) return f end |
#encode(f) ⇒ Object
122 123 124 125 126 127 128 129 |
# File 'lib/codec/fix.rb', line 122 def encode(f) out = f.get_value if @length > 0 raise TooLongDataException if out.length > @length out = out.ljust(@length," ") end return out end |