Method: ReDNS::Buffer#initialize
- Defined in:
- lib/redns/buffer.rb
#initialize(contents = nil, offset = nil, size = nil) ⇒ Buffer
Create a buffer with arbitrary String contents. The offset parameter indicates where to start reading, which defaults to character 0 at the start of the string. The size parameter is used to limit how much of the content is used
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/redns/buffer.rb', line 22 def initialize(contents = nil, offset = nil, size = nil) if (contents.respond_to?(:serialize)) super('') @offset = 0 @size = string_length contents.serialize(self) else super(contents || '') @offset = offset ? offset.to_i : 0 @size = size ? size.to_i : string_length end advance(0) end |