class Busted::Profiler::Sandwich

Constants

VALID_ACTIONS

Attributes

action[RW]
report[R]
trace[R]

Public Class Methods

run(options = {}) click to toggle source
# File lib/busted/profiler/sandwich.rb, line 17
def self.run(options = {})
  action = options.fetch :action, false
  trace = options.fetch :trace, false

  unless VALID_ACTIONS.include? action
    fail ArgumentError, "profiler requires start or finish action"
  end

  sandwich = instance

  sandwich.action = action
  sandwich.trace = trace
  sandwich.run
end

Public Instance Methods

run() click to toggle source
# File lib/busted/profiler/sandwich.rb, line 32
def run
  send action
end
trace=(trace) click to toggle source
# File lib/busted/profiler/sandwich.rb, line 36
def trace=(trace)
  @trace = trace if start?
end

Private Instance Methods

finish() click to toggle source
# File lib/busted/profiler/sandwich.rb, line 53
def finish
  finish_counter
  finish_tracer
  report.dup
end
start() click to toggle source
# File lib/busted/profiler/sandwich.rb, line 46
def start
  @report = {}
  start_tracer
  start_counter
  true
end
start?() click to toggle source
# File lib/busted/profiler/sandwich.rb, line 42
def start?
  action == :start
end