Sha256: 9980f9a7cacaa7edd231b79b836adba9f042a5e28225918e91a909e8953f4637

Contents?: true

Size: 559 Bytes

Versions: 12

Compression:

Stored size: 559 Bytes

Contents

# frozen_string_literal: true

require 'active_support'

class DHS::Record

  module Tracing
    extend ActiveSupport::Concern

    module ClassMethods
      # Needs to be called directly from the first method (level) within DHS
      def trace!(options = {})
        return options unless DHS.config.trace

        (options || {}).tap do |options|
          source = caller.detect do |source|
            !source.match?(%r{/lib/dhs}) && !source.match?(%r{internal\:})
          end
          options[:source] = source
        end
      end
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
dhs-1.6.0 lib/dhs/concerns/record/tracing.rb
dhs-1.5.0 lib/dhs/concerns/record/tracing.rb
dhs-1.4.2 lib/dhs/concerns/record/tracing.rb
dhs-1.4.1 lib/dhs/concerns/record/tracing.rb
dhs-1.4.0 lib/dhs/concerns/record/tracing.rb
dhs-1.3.0 lib/dhs/concerns/record/tracing.rb
dhs-1.2.0 lib/dhs/concerns/record/tracing.rb
dhs-1.1.0 lib/dhs/concerns/record/tracing.rb
dhs-1.0.3 lib/dhs/concerns/record/tracing.rb
dhs-1.0.2 lib/dhs/concerns/record/tracing.rb
dhs-1.0.1 lib/dhs/concerns/record/tracing.rb
dhs-1.0.0 lib/dhs/concerns/record/tracing.rb