Module: Datadog::Core::Configuration::Options::InstanceMethods
- Defined in:
- lib/datadog/core/configuration/options.rb
Overview
Instance behavior for a configuration object with options
Instance Method Summary collapse
- #get_option(name) ⇒ Object
- #option_defined?(name) ⇒ Boolean
- #options ⇒ Object
- #options_hash ⇒ Object
- #reset_option(name) ⇒ Object
- #reset_options! ⇒ Object
- #set_option(name, value, precedence: Configuration::Option::Precedence::PROGRAMMATIC) ⇒ Object
- #unset_option(name, precedence: Configuration::Option::Precedence::PROGRAMMATIC) ⇒ Object
-
#using_default?(name) ⇒ Boolean
Is this option’s value the default fallback value?.
Instance Method Details
#get_option(name) ⇒ Object
78 79 80 |
# File 'lib/datadog/core/configuration/options.rb', line 78 def get_option(name) resolve_option(name).get end |
#option_defined?(name) ⇒ Boolean
87 88 89 |
# File 'lib/datadog/core/configuration/options.rb', line 87 def option_defined?(name) self.class..key?(name) end |
#options ⇒ Object
66 67 68 |
# File 'lib/datadog/core/configuration/options.rb', line 66 def @options ||= {} end |
#options_hash ⇒ Object
97 98 99 100 101 |
# File 'lib/datadog/core/configuration/options.rb', line 97 def self.class..merge().each_with_object({}) do |(key, _), hash| hash[key] = get_option(key) end end |
#reset_option(name) ⇒ Object
82 83 84 85 |
# File 'lib/datadog/core/configuration/options.rb', line 82 def reset_option(name) assert_valid_option!(name) [name].reset if .key?(name) end |
#reset_options! ⇒ Object
103 104 105 |
# File 'lib/datadog/core/configuration/options.rb', line 103 def .each_value(&:reset) end |
#set_option(name, value, precedence: Configuration::Option::Precedence::PROGRAMMATIC) ⇒ Object
70 71 72 |
# File 'lib/datadog/core/configuration/options.rb', line 70 def set_option(name, value, precedence: Configuration::Option::Precedence::PROGRAMMATIC) resolve_option(name).set(value, precedence: precedence, resolved_env: resolved_env(name)) end |
#unset_option(name, precedence: Configuration::Option::Precedence::PROGRAMMATIC) ⇒ Object
74 75 76 |
# File 'lib/datadog/core/configuration/options.rb', line 74 def unset_option(name, precedence: Configuration::Option::Precedence::PROGRAMMATIC) resolve_option(name).unset(precedence) end |
#using_default?(name) ⇒ Boolean
Is this option’s value the default fallback value?
92 93 94 95 |
# File 'lib/datadog/core/configuration/options.rb', line 92 def using_default?(name) get_option(name) # Resolve value check if environment variable overwrote the default [name].default_precedence? end |