Method: Codec::Numstr#encode

Defined in:
lib/codec/fix.rb

#encode(buf, field) ⇒ Object



72
73
74
75
76
77
78
79
80
# File 'lib/codec/fix.rb', line 72

def encode(buf,field)
  out = field.get_value.to_s
  if @length > 0
    out = out.rjust(@length,"0")
    raise TooLongDataException if out.length > @length
  end
  buf << out
  return out.length
end