lib/bluepill/util/rotational_array.rb in bluepill-0.0.42 vs lib/bluepill/util/rotational_array.rb in bluepill-0.0.43
- old
+ new
@@ -53,9 +53,15 @@
start = @counter >= @capacity ? rotational_idx(@counter) : 0
times.times do |i|
block.call(self[rotational_idx(start + i)])
end
end
+
+ unless method_defined?(:nitems)
+ def nitems
+ compact.length
+ end
+ end
private
def rotational_idx(idx)
idx % @capacity