Class: Rbzlib::Posf

Inherits:
Bytef_str show all
Defined in:
lib/pr/rbzlib.rb

Instance Attribute Summary

Attributes inherited from Bytef_str

#buffer, #offset

Instance Method Summary collapse

Methods inherited from Bytef_str

#current, #initialize, #length

Constructor Details

This class inherits a constructor from Rbzlib::Bytef_str

Instance Method Details

#+(inc) ⇒ Object



233
234
235
236
# File 'lib/pr/rbzlib.rb', line 233

def +(inc)
  @offset += inc * 2
  self
end

#-(dec) ⇒ Object



238
239
240
241
# File 'lib/pr/rbzlib.rb', line 238

def -(dec)
  @offset -= dec * 2
  self
end

#[](idx) ⇒ Object



243
244
245
# File 'lib/pr/rbzlib.rb', line 243

def [](idx)
  @buffer[(idx * 2) + @offset, 2].unpack('v').first
end

#[]=(idx, val) ⇒ Object



247
248
249
# File 'lib/pr/rbzlib.rb', line 247

def []=(idx, val)
  @buffer[(idx * 2) + @offset, 2] = [val].pack('v')
end

#getObject



251
252
253
# File 'lib/pr/rbzlib.rb', line 251

def get()
  @buffer[@offset, 2].unpack('v').first
end

#set(val) ⇒ Object



255
256
257
# File 'lib/pr/rbzlib.rb', line 255

def set(val)
  @buffer[@offset, 2] = [val].pack('v')
end