Module: ControllerRuntime::RuntimeRegistry

Defined in:
lib/controller_runtime/runtime_registry.rb

Overview

Keeps track of the runtime for a given config/event.

Class Method Summary collapse

Class Method Details

.increment_runtime(name, runtime) ⇒ Object



16
17
18
# File 'lib/controller_runtime/runtime_registry.rb', line 16

def increment_runtime(name, runtime)
  ActiveSupport::IsolatedExecutionState["#{name}_runtime".to_sym] = self.runtime(name) + runtime
end

.reset(name) ⇒ Object



20
21
22
23
24
# File 'lib/controller_runtime/runtime_registry.rb', line 20

def reset(name)
  rt = runtime(name)
  set_runtime(name, 0.0)
  rt
end

.runtime(name) ⇒ Object



8
9
10
# File 'lib/controller_runtime/runtime_registry.rb', line 8

def runtime(name)
  ActiveSupport::IsolatedExecutionState["#{name}_runtime".to_sym] ||= 0.0
end

.set_runtime(name, runtime) ⇒ Object



12
13
14
# File 'lib/controller_runtime/runtime_registry.rb', line 12

def set_runtime(name, runtime)
  ActiveSupport::IsolatedExecutionState["#{name}_runtime".to_sym] = runtime
end