Class: Rubinius::ByteArray

Inherits:
Object
  • Object
show all
Defined in:
lib/rubinius/kernel/common/bytearray.rb

Overview

An array of bytes, used as a low-level data store for implementing various other classes.

Instance Method Summary collapse

Instance Method Details

#<=>(other) ⇒ Object



23
24
25
# File 'lib/rubinius/kernel/common/bytearray.rb', line 23

def <=>(other)
  compare_bytes other, size, other.size
end

#eachObject



9
10
11
12
13
14
15
16
17
# File 'lib/rubinius/kernel/common/bytearray.rb', line 9

def each
  i = 0
  max = size()

  while i < max
    yield get_byte(i)
    i += 1
  end
end

#inspectObject



19
20
21
# File 'lib/rubinius/kernel/common/bytearray.rb', line 19

def inspect
  "#<#{self.class}:0x#{object_id.to_s(16)} #{size} bytes>"
end