Module: Datadog::Configuration::Options::InstanceMethods
- Defined in:
- lib/ddtrace/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) ⇒ Object
Instance Method Details
#get_option(name) ⇒ Object
68 69 70 71 |
# File 'lib/ddtrace/configuration/options.rb', line 68 def get_option(name) add_option(name) unless .key?(name) [name].get end |
#option_defined?(name) ⇒ Boolean
78 79 80 |
# File 'lib/ddtrace/configuration/options.rb', line 78 def option_defined?(name) self.class..key?(name) end |
#options ⇒ Object
59 60 61 |
# File 'lib/ddtrace/configuration/options.rb', line 59 def ||= OptionSet.new end |
#options_hash ⇒ Object
82 83 84 85 86 |
# File 'lib/ddtrace/configuration/options.rb', line 82 def .each_with_object({}) do |(key, _), hash| hash[key] = get_option(key) end end |
#reset_option(name) ⇒ Object
73 74 75 76 |
# File 'lib/ddtrace/configuration/options.rb', line 73 def reset_option(name) assert_valid_option!(name) [name].reset if .key?(name) end |
#reset_options! ⇒ Object
88 89 90 |
# File 'lib/ddtrace/configuration/options.rb', line 88 def .values.each(&:reset) end |
#set_option(name, value) ⇒ Object
63 64 65 66 |
# File 'lib/ddtrace/configuration/options.rb', line 63 def set_option(name, value) add_option(name) unless .key?(name) [name].set(value) end |