Class: Knapsack::Tracker
- Inherits:
-
Object
- Object
- Knapsack::Tracker
- Includes:
- Singleton
- Defined in:
- lib/knapsack/tracker.rb
Instance Attribute Summary collapse
-
#files ⇒ Object
readonly
Returns the value of attribute files.
-
#global_time ⇒ Object
readonly
Returns the value of attribute global_time.
-
#spec_path ⇒ Object
writeonly
Sets the attribute spec_path.
Instance Method Summary collapse
- #config(opts = {}) ⇒ Object
- #generate_report? ⇒ Boolean
-
#initialize ⇒ Tracker
constructor
A new instance of Tracker.
- #reset! ⇒ Object
- #start_timer ⇒ Object
- #stop_timer ⇒ Object
Constructor Details
#initialize ⇒ Tracker
Returns a new instance of Tracker.
10 11 12 |
# File 'lib/knapsack/tracker.rb', line 10 def initialize set_defaults end |
Instance Attribute Details
#files ⇒ Object (readonly)
Returns the value of attribute files.
7 8 9 |
# File 'lib/knapsack/tracker.rb', line 7 def files @files end |
#global_time ⇒ Object (readonly)
Returns the value of attribute global_time.
7 8 9 |
# File 'lib/knapsack/tracker.rb', line 7 def global_time @global_time end |
#spec_path=(value) ⇒ Object
Sets the attribute spec_path
8 9 10 |
# File 'lib/knapsack/tracker.rb', line 8 def spec_path=(value) @spec_path = value end |
Instance Method Details
#config(opts = {}) ⇒ Object
18 19 20 21 |
# File 'lib/knapsack/tracker.rb', line 18 def config(opts={}) @config ||= default_config @config.merge!(opts) end |
#generate_report? ⇒ Boolean
14 15 16 |
# File 'lib/knapsack/tracker.rb', line 14 def generate_report? ENV['KNAPSACK_GENERATE_REPORT'] || false end |
#reset! ⇒ Object
23 24 25 |
# File 'lib/knapsack/tracker.rb', line 23 def reset! set_defaults end |
#start_timer ⇒ Object
27 28 29 |
# File 'lib/knapsack/tracker.rb', line 27 def start_timer @start_time = Time.now.to_f end |
#stop_timer ⇒ Object
31 32 33 34 35 36 |
# File 'lib/knapsack/tracker.rb', line 31 def stop_timer @execution_time = Time.now.to_f - @start_time update_global_time update_spec_file_time @execution_time end |