Sha256: 3855fb5569d76b732ce714e84ae9db5b2ca9f75003bef115bc50ae8a95ebfc6b

Contents?: true

Size: 634 Bytes

Versions: 16

Compression:

Stored size: 634 Bytes

Contents

# frozen_string_literal: true

module InstrumentAllTheThings
  Context = Struct.new(:method_name, :instance, :tags, keyword_init: true) do
    def stats_name(klass_or_instance)
      @stats_name ||= [
        class_name(klass_or_instance),
        "#{instance ? 'instance' : 'class'}_methods",
        method_name,
      ].join('.')
    end

    def trace_name(klass_or_instance)
      @trace_name ||= "#{class_name(klass_or_instance)}#{instance ? '.' : '#'}#{method_name}"
    end

    private

    def class_name(klass_or_instance)
      klass_or_instance.is_a?(Class) ? klass_or_instance.to_s : klass_or_instance
    end
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
instrument_all_the_things-5.0.1 lib/instrument_all_the_things/context.rb
instrument_all_the_things-5.0.0 lib/instrument_all_the_things/context.rb
instrument_all_the_things-1.4.0 lib/instrument_all_the_things/context.rb
instrument_all_the_things-4.0.0 lib/instrument_all_the_things/context.rb
instrument_all_the_things-3.1.2 lib/instrument_all_the_things/context.rb
instrument_all_the_things-3.1.2.pre1 lib/instrument_all_the_things/context.rb
instrument_all_the_things-3.1.1 lib/instrument_all_the_things/context.rb
instrument_all_the_things-3.1.0 lib/instrument_all_the_things/context.rb
instrument_all_the_things-3.1.0.pre1 lib/instrument_all_the_things/context.rb
instrument_all_the_things-3.0.0 lib/instrument_all_the_things/context.rb
instrument_all_the_things-3.0.0.pre1 lib/instrument_all_the_things/context.rb
instrument_all_the_things-2.0.2 lib/instrument_all_the_things/context.rb
instrument_all_the_things-2.0.1 lib/instrument_all_the_things/context.rb
instrument_all_the_things-2.0.0 lib/instrument_all_the_things/context.rb
instrument_all_the_things-1.3.1 lib/instrument_all_the_things/context.rb
instrument_all_the_things-1.3.0 lib/instrument_all_the_things/context.rb