lib/bitwise.rb in bitwise-0.3.0 vs lib/bitwise.rb in bitwise-0.3.1
- old
+ new
@@ -45,10 +45,11 @@
2**(7 - @mod)
end
def get_byte(index)
@div, @mod = index.divmod(8)
+ raise IndexError, 'out of bounds' if @div < 0 or @div >= @value.bytesize
@byte = @value.getbyte(@div)
end
def not
Bitwise.new(Bitwise.string_not(self.value))
@@ -86,10 +87,10 @@
max_index = array.max
@value = "\x00" * (max_index.div(8) + 1)
array.each do |index|
set_at(index)
end
- @value.bytesize
+ array.size
end
def indexes
indexes = []
position = 0