# File lib/celluloid/logging/ring_buffer.rb, line 49 def clear @buffer = Array.new(@size) @start = 0 @count = 0 end
# File lib/celluloid/logging/ring_buffer.rb, line 15 def empty? @count == 0 end
# File lib/celluloid/logging/ring_buffer.rb, line 39 def flush values = [] @mutex.synchronize do while !empty? values << remove_element end end values end
# File lib/celluloid/logging/ring_buffer.rb, line 11 def full? @count == @size end
# File lib/celluloid/logging/ring_buffer.rb, line 19 def push(value) @mutex.synchronize do stop = (@start + @count) % @size @buffer[stop] = value if full? @start = (@start + 1) % @size else @count += 1 end value end end
Generated with the Darkfish Rdoc Generator 2.