Module: Datadog::Core::Configuration::Base::InstanceMethods
- Defined in:
- lib/datadog/core/configuration/base.rb
Overview
Instance methods for configuration
Instance Method Summary collapse
- #configure(opts = {}) {|_self| ... } ⇒ Object
-
#dig(*options) ⇒ Object
Retrieves a nested option from a list of symbols.
- #initialize(options = {}) ⇒ Object
- #reset! ⇒ Object
- #to_h ⇒ Object
Instance Method Details
#configure(opts = {}) {|_self| ... } ⇒ Object
56 57 58 59 60 61 62 63 64 65 66 67 |
# File 'lib/datadog/core/configuration/base.rb', line 56 def configure(opts = {}) opts.each do |name, value| if respond_to?("#{name}=") send("#{name}=", value) elsif option_defined?(name) set_option(name, value) end end # Apply any additional settings from block yield(self) if block_given? end |
#dig(*options) ⇒ Object
Retrieves a nested option from a list of symbols
74 75 76 77 78 79 80 |
# File 'lib/datadog/core/configuration/base.rb', line 74 def dig(*) raise ArgumentError, 'expected at least one option' if .empty? .inject(self) do |receiver, option| receiver.send(option) end end |
#initialize(options = {}) ⇒ Object
52 53 54 |
# File 'lib/datadog/core/configuration/base.rb', line 52 def initialize( = {}) configure() unless .empty? end |
#reset! ⇒ Object
82 83 84 |
# File 'lib/datadog/core/configuration/base.rb', line 82 def reset! end |
#to_h ⇒ Object
69 70 71 |
# File 'lib/datadog/core/configuration/base.rb', line 69 def to_h end |