Class: Evidence::Counter
- Inherits:
-
Object
- Object
- Evidence::Counter
- Includes:
- Enumerable
- Defined in:
- lib/evidence/stream.rb
Instance Method Summary collapse
- #each(&block) ⇒ Object
- #eos? ⇒ Boolean
-
#initialize ⇒ Counter
constructor
A new instance of Counter.
Constructor Details
#initialize ⇒ Counter
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
99 100 101 |
# File 'lib/evidence/stream.rb', line 99 def eos? false end |