Sha256: 0f4482998c46b991f65a964cb70d9adc9048cad3e0da126cac39114cba412455

Contents?: true

Size: 889 Bytes

Versions: 1

Compression:

Stored size: 889 Bytes

Contents

# frozen_string_literal: true

require_relative 'trace_location/collector'
require_relative 'trace_location/config'
require_relative 'trace_location/report'
require_relative 'trace_location/version'

begin
  require 'rails'
  require_relative 'trace_location/railtie'
rescue LoadError
  nil
end

module TraceLocation # :nodoc:
  def self.trace(options = {}, &block)
    match = options.delete(:match)
    ignore = options.delete(:ignore)
    methods = options.delete(:methods)

    result = Collector.collect(match: match, ignore: ignore, methods: methods, &block)
    Report.build(result.events, result.return_value, options).generate
    true
  rescue StandardError => e
    $stderr.puts "Failure: TraceLocation got an unexpected error."
    $stderr.puts e.full_message
    false
  end

  def self.configure
    yield config
  end

  def self.config
    @config ||= Config.new
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
trace_location-0.12.0 lib/trace_location.rb