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.



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

def initialize
  @options = {}
end

Instance Attribute Details

#optionsObject (readonly)

Returns the value of attribute options.



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

def options
  @options
end

Class Method Details

.add_getter!(option) ⇒ Object



83
84
85
86
87
88
89
# File 'lib/datadog/tracing/contrib/grpc/datadog_interceptor.rb', line 83

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



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

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