Module: Datadog::Configuration::Base::InstanceMethods
- Defined in:
- lib/ddtrace/configuration/base.rb
Overview
Instance methods for configuration
Instance Method Summary collapse
- #configure(opts = {}) {|_self| ... } ⇒ Object
- #initialize(options = {}) ⇒ Object
- #reset! ⇒ Object
- #to_h ⇒ Object
Instance Method Details
#configure(opts = {}) {|_self| ... } ⇒ Object
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 |
# File 'lib/ddtrace/configuration/base.rb', line 49 def configure(opts = {}) # Sort the options in preference of dependency order first ordering = self.class..dependency_order sorted_opts = opts.sort_by do |name, _value| ordering.index(name) || (ordering.length + 1) end # Ruby 2.0 doesn't support Array#to_h sorted_opts = Hash[*sorted_opts.flatten] # Apply options in sort order sorted_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 |
#initialize(options = {}) ⇒ Object
45 46 47 |
# File 'lib/ddtrace/configuration/base.rb', line 45 def initialize( = {}) configure() end |
#reset! ⇒ Object
76 77 78 |
# File 'lib/ddtrace/configuration/base.rb', line 76 def reset! end |
#to_h ⇒ Object
72 73 74 |
# File 'lib/ddtrace/configuration/base.rb', line 72 def to_h end |