Class: Nl::Protocols::Raw::DataTypes::Pad

Inherits:
Object
  • Object
show all
Defined in:
lib/nl/protocols/raw.rb

Instance Method Summary collapse

Constructor Details

#initialize(length = nil) ⇒ Pad

Returns a new instance of Pad.



335
336
337
# File 'lib/nl/protocols/raw.rb', line 335

def initialize(length = nil)
  @length = length
end

Instance Method Details

#decode(decoder) ⇒ Object



343
344
345
346
# File 'lib/nl/protocols/raw.rb', line 343

def decode(decoder)
  @length ? decoder.skip(@length) : decoder.skip
  nil
end

#encode(encoder, _value) ⇒ Object



339
340
341
# File 'lib/nl/protocols/raw.rb', line 339

def encode(encoder, _value)
  encoder.put_string(?\0.b * @length) if @length
end