Class: Datadog::Tracing::Contrib::GRPC::DatadogInterceptor::Base::PinAdapter

Inherits:
Object
  • Object
show all
Defined in:
lib/datadog/tracing/contrib/grpc/datadog_interceptor.rb

Overview

Allows interceptors to define settings using methods instead of ‘[]`

Constant Summary collapse

OPTIONS =
Configuration::Settings.instance_methods(false).freeze

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializePinAdapter

Returns a new instance of PinAdapter.



67
68
69
# File 'lib/datadog/tracing/contrib/grpc/datadog_interceptor.rb', line 67

def initialize
  @options = {}
end

Instance Attribute Details

#optionsObject (readonly)

Returns the value of attribute options.



65
66
67
# File 'lib/datadog/tracing/contrib/grpc/datadog_interceptor.rb', line 65

def options
  @options
end

Class Method Details

.add_getter!(option) ⇒ Object



77
78
79
80
81
82
83
# File 'lib/datadog/tracing/contrib/grpc/datadog_interceptor.rb', line 77

def self.add_getter!(option)
  define_method(option) do
    return @options[option] if @options.key?(option)

    Datadog.configuration.tracing[:grpc][option]
  end
end

.add_setter!(option) ⇒ Object



71
72
73
74
75
# File 'lib/datadog/tracing/contrib/grpc/datadog_interceptor.rb', line 71

def self.add_setter!(option)
  define_method(option) do |value|
    @options[option.to_s[0...-1].to_sym] = value
  end
end