Sha256: b36a7ea719aee61c37c39adf8bbc36a65faec63862ee7683c7053293d3dcc7c8

Contents?: true

Size: 614 Bytes

Versions: 4

Compression:

Stored size: 614 Bytes

Contents

module Busted
  module Profiler
    class Default

      include Busted::Traceable
      include Busted::Countable

      attr_reader :trace, :block, :report

      def self.run(options = {}, &block)
        new(options, &block).run
      end

      def initialize(options = {}, &block)
        fail LocalJumpError, "no block given" unless block

        @trace = options.fetch :trace, false
        @block = block
        @report = {}
      end

      def run
        start_tracer
        start_counter

        block.call

        finish_counter
        finish_tracer

        report
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
busted-0.2.3 lib/busted/profiler/default.rb
busted-0.2.2 lib/busted/profiler/default.rb
busted-0.2.1 lib/busted/profiler/default.rb
busted-0.2.0 lib/busted/profiler/default.rb