Method: Codec::Numpck#encode
- Defined in:
- lib/codec/packed.rb
#encode(field) ⇒ Object
43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/codec/packed.rb', line 43 def encode(field) out = field.get_value.to_s if @length > 0 out = out.rjust(@length,"0") raise TooLongDataException if out.length > @length end l = out.length out.prepend("0") if out.length.odd? out = [out].pack("H*") return out end |