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
#initialize(stack = Stack.new) ⇒ Counter
Returns a new instance of Counter.
6 7 8 |
# File 'lib/busted/counter.rb', line 6 def initialize(stack = Stack.new) @stack = stack end |
Instance Method Details
#finish ⇒ Object
14 15 16 |
# File 'lib/busted/counter.rb', line 14 def finish stack.finished = counts end |
#report ⇒ Object
18 19 20 21 22 23 24 25 |
# File 'lib/busted/counter.rb', line 18 def report started = stack.started finished = stack.finished [:method, :constant].each_with_object({}) do |counter, result| result[counter] = finished[counter] - started[counter] end end |
#start ⇒ Object
10 11 12 |
# File 'lib/busted/counter.rb', line 10 def start stack.started = counts end |