Class: Busted::Counter
- Inherits:
-
Object
- Object
- Busted::Counter
- Defined in:
- lib/busted/counter.rb
Instance Method Summary collapse
- #finish ⇒ Object
-
#initialize(stack = Stack.new) ⇒ Counter
constructor
A new instance of Counter.
- #report ⇒ Object
- #start ⇒ Object
Constructor Details
Instance Method Details
#finish ⇒ Object
16 17 18 |
# File 'lib/busted/counter.rb', line 16 def finish lock.synchronize { stack.finished = counts } end |
#report ⇒ Object
20 21 22 23 24 25 26 27 28 29 |
# File 'lib/busted/counter.rb', line 20 def report lock.synchronize do started = stack.started finished = stack.finished [:method, :constant].each_with_object({}) do |counter, result| result[counter] = finished[counter] - started[counter] end end end |
#start ⇒ Object
12 13 14 |
# File 'lib/busted/counter.rb', line 12 def start lock.synchronize { stack.started = counts } end |