Class: ActionController::RequestProfiler::Sandbox
- Includes:
- Integration::Runner
- Defined in:
- lib/action_controller/request_profiler.rb
Overview
Wrap up the integration session runner.
Class Method Summary collapse
Instance Method Summary collapse
- #benchmark(n) ⇒ Object
-
#initialize(script_path) ⇒ Sandbox
constructor
A new instance of Sandbox.
- #say(message) ⇒ Object
Methods included from Integration::Runner
#copy_session_variables!, #method_missing, #open_session, #reset!
Constructor Details
#initialize(script_path) ⇒ Sandbox
Returns a new instance of Sandbox.
14 15 16 17 18 |
# File 'lib/action_controller/request_profiler.rb', line 14 def initialize(script_path) @quiet = false define_run_method(script_path) reset! end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class ActionController::Integration::Runner
Class Method Details
.benchmark(n, script) ⇒ Object
10 11 12 |
# File 'lib/action_controller/request_profiler.rb', line 10 def self.benchmark(n, script) new(script).benchmark(n) end |
Instance Method Details
#benchmark(n) ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/action_controller/request_profiler.rb', line 20 def benchmark(n) @quiet = true print ' ' result = Benchmark.realtime do n.times do |i| run print_progress(i) end end puts result ensure @quiet = false end |
#say(message) ⇒ Object
37 38 39 |
# File 'lib/action_controller/request_profiler.rb', line 37 def say() puts " #{}" unless @quiet end |