Class: Nl::Protocols::Raw::DataTypes::Pad
- Inherits:
-
Object
- Object
- Nl::Protocols::Raw::DataTypes::Pad
- Defined in:
- lib/nl/protocols/raw.rb
Instance Method Summary collapse
- #decode(decoder) ⇒ Object
- #encode(encoder, _value) ⇒ Object
-
#initialize(length = nil) ⇒ Pad
constructor
A new instance of Pad.
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 |