Sha256: 65fcc261de7399668e691760aec43138256505b59e4f553a221ae37cb2a53467

Contents?: true

Size: 832 Bytes

Versions: 2

Compression:

Stored size: 832 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)

    result = Collector.collect(match: match, ignore: ignore, &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

2 entries across 2 versions & 1 rubygems

Version Path
trace_location-0.11.0 lib/trace_location.rb
trace_location-0.10.0 lib/trace_location.rb