Class: Evidence::Counter

Inherits:
Object
  • Object
show all
Includes:
Enumerable
Defined in:
lib/evidence/stream.rb

Instance Method Summary collapse

Constructor Details

#initializeCounter

Returns a new instance of Counter.



95
96
97
# File 'lib/evidence/stream.rb', line 95

def initialize
  @count = 0
end

Instance Method Details

#each(&block) ⇒ Object



103
104
105
106
107
# File 'lib/evidence/stream.rb', line 103

def each(&block)
  loop do
    block.call(@count += 1)
  end
end

#eos?Boolean

Returns:

  • (Boolean)


99
100
101
# File 'lib/evidence/stream.rb', line 99

def eos?
  false
end