Module: PowerTrace

Defined in:
lib/power_trace.rb,
lib/power_trace/entry.rb,
lib/power_trace/stack.rb,
lib/power_trace/version.rb,
lib/power_trace/helpers/colorize_helper.rb

Defined Under Namespace

Modules: ColorizeHelper Classes: Entry, Stack

Constant Summary collapse

AVAILABLE_INTEGRATIONS =
[:rails, :rspec, :minitest].freeze
VERSION =
"0.3.0"

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.integrations=(integrations) ⇒ Object



23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/power_trace.rb', line 23

def integrations=(integrations)
  integrations = Array(integrations).uniq.map(&:to_sym)

  integrations.each do |integration|
    unless AVAILABLE_INTEGRATIONS.include?(integration)
      raise "#{integration} is not a supported integration, only #{AVAILABLE_INTEGRATIONS} is allowed."
    end

    case integration
    when :rails
      require "power_trace/integrations/rails"
    when :rspec
      require "power_trace/integrations/rspec"
    when :minitest
      require "power_trace/integrations/minitest"
    end
  end

  @@integrations = integrations
end


44
45
46
47
48
# File 'lib/power_trace.rb', line 44

def print_power_trace_error(exception)
  puts(exception)
  puts(exception.backtrace)
  puts("there's a bug in power_trace, please open an issue at https://github.com/st0012/power_trace")
end

Instance Method Details

#power_trace(options = {}) ⇒ Object



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

def power_trace(options = {})
  PowerTrace::Stack.new(options)
end