Class: KnapsackPro::Tracker
- Inherits:
-
Object
- Object
- KnapsackPro::Tracker
- Includes:
- Singleton
- Defined in:
- lib/knapsack_pro/tracker.rb
Instance Attribute Summary collapse
- #current_test_path ⇒ Object
-
#global_time ⇒ Object
readonly
Returns the value of attribute global_time.
-
#test_files_with_time ⇒ Object
readonly
Returns the value of attribute test_files_with_time.
Instance Method Summary collapse
-
#initialize ⇒ Tracker
constructor
A new instance of Tracker.
- #reset! ⇒ Object
- #start_timer ⇒ Object
- #stop_timer ⇒ Object
- #to_a ⇒ Object
Constructor Details
#initialize ⇒ Tracker
Returns a new instance of Tracker.
8 9 10 |
# File 'lib/knapsack_pro/tracker.rb', line 8 def initialize set_defaults end |
Instance Attribute Details
#current_test_path ⇒ Object
27 28 29 30 |
# File 'lib/knapsack_pro/tracker.rb', line 27 def current_test_path raise("current_test_path needs to be set by Knapsack Pro Adapter's bind method") unless @current_test_path @current_test_path.sub(/^\.\//, '') end |
#global_time ⇒ Object (readonly)
Returns the value of attribute global_time.
5 6 7 |
# File 'lib/knapsack_pro/tracker.rb', line 5 def global_time @global_time end |
#test_files_with_time ⇒ Object (readonly)
Returns the value of attribute test_files_with_time.
5 6 7 |
# File 'lib/knapsack_pro/tracker.rb', line 5 def test_files_with_time @test_files_with_time end |
Instance Method Details
#reset! ⇒ Object
12 13 14 |
# File 'lib/knapsack_pro/tracker.rb', line 12 def reset! set_defaults end |
#start_timer ⇒ Object
16 17 18 |
# File 'lib/knapsack_pro/tracker.rb', line 16 def start_timer @start_time = now_without_mock_time.to_f end |
#stop_timer ⇒ Object
20 21 22 23 24 25 |
# File 'lib/knapsack_pro/tracker.rb', line 20 def stop_timer @execution_time = @start_time ? now_without_mock_time.to_f - @start_time : 0.0 update_global_time update_test_file_time @execution_time end |
#to_a ⇒ Object
32 33 34 35 36 37 38 39 40 41 |
# File 'lib/knapsack_pro/tracker.rb', line 32 def to_a test_files = [] @test_files_with_time.each do |path, time_execution| test_files << { path: path, time_execution: time_execution } end test_files end |