Sha256: 67cc01001415dbedb76e37128b453d07a9b4799c2dbaf991e03e7f6bd9a8750b
Contents?: true
Size: 1.01 KB
Versions: 2
Compression:
Stored size: 1.01 KB
Contents
require "singleton" module Busted module Profiler class Sandwich include Singleton include Busted::Traceable include Busted::Countable VALID_ACTIONS = [:start, :finish].freeze attr_accessor :action attr_reader :trace, :report 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 def run send action end def trace=(trace) @trace = trace if start? end private def start? action == :start end def start @report = {} start_tracer start_counter end def finish finish_counter finish_tracer report end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
busted-0.2.1 | lib/busted/profiler/sandwich.rb |
busted-0.2.0 | lib/busted/profiler/sandwich.rb |