Class: Codec::String
Direct Known Subclasses
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
139 140 141 |
# File 'lib/codec/fix.rb', line 139 def build_field(buf, f, length) f.set_value(buf.slice!(0...length)) end |
#encode(buf, f) ⇒ Object
143 144 145 146 147 148 149 150 151 |
# File 'lib/codec/fix.rb', line 143 def encode(buf, f) out = f.get_value if @length > 0 raise TooLongDataException if out.length > @length out = out.ljust(@length," ") end buf << out return out.length end |