Class: Rbzlib::Bytef_arr

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

Instance Attribute Summary

Attributes inherited from Bytef_str

#buffer, #offset

Instance Method Summary collapse

Methods inherited from Bytef_str

#+, #-, #current, #length

Constructor Details

#initialize(buffer, offset = 0) ⇒ Bytef_arr

Returns a new instance of Bytef_arr.



8
9
10
11
# File 'lib/pr/rbzlib/bytef_arr.rb', line 8

def initialize(buffer, offset = 0)
  @buffer = buffer
  @offset = offset
end

Instance Method Details

#[](idx) ⇒ Object



13
14
15
# File 'lib/pr/rbzlib/bytef_arr.rb', line 13

def [](idx)
  @buffer[idx + @offset]
end

#[]=(idx, val) ⇒ Object



17
18
19
# File 'lib/pr/rbzlib/bytef_arr.rb', line 17

def []=(idx, val)
  @buffer[idx + @offset] = val
end

#getObject



21
22
23
# File 'lib/pr/rbzlib/bytef_arr.rb', line 21

def get
  @buffer[@offset]
end

#set(val) ⇒ Object



25
26
27
# File 'lib/pr/rbzlib/bytef_arr.rb', line 25

def set(val)
  @buffer[@offset] = val
end