Method: CouchShell::RingBuffer#current

Defined in:
lib/couch-shell/ring_buffer.rb

#currentObject



40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# File 'lib/couch-shell/ring_buffer.rb', line 40

def current
  if @index.nil?
    if block_given?
      nil
    else
      raise UninitializedAccess.new(0)
    end
  else
    if block_given?
      yield @ary[index]
    else
      @ary[index]
    end
  end
end