Class: Datadog::Configuration::OptionDefinition
- Inherits:
-
Object
- Object
- Datadog::Configuration::OptionDefinition
- Defined in:
- lib/ddtrace/configuration/option_definition.rb
Overview
Represents a definition for an integration configuration option
Constant Summary collapse
- IDENTITY =
->(x) { x }
Instance Attribute Summary collapse
-
#default ⇒ Object
readonly
Returns the value of attribute default.
-
#depends_on ⇒ Object
readonly
Returns the value of attribute depends_on.
-
#lazy ⇒ Object
readonly
Returns the value of attribute lazy.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#setter ⇒ Object
readonly
Returns the value of attribute setter.
Instance Method Summary collapse
- #default_value ⇒ Object
-
#initialize(name, meta = {}, &block) ⇒ OptionDefinition
constructor
A new instance of OptionDefinition.
Constructor Details
#initialize(name, meta = {}, &block) ⇒ OptionDefinition
14 15 16 17 18 19 20 |
# File 'lib/ddtrace/configuration/option_definition.rb', line 14 def initialize(name, = {}, &block) @default = [:default] @depends_on = [:depends_on] || [] @lazy = [:lazy] || false @name = name.to_sym @setter = [:setter] || block || IDENTITY end |
Instance Attribute Details
#default ⇒ Object (readonly)
Returns the value of attribute default.
7 8 9 |
# File 'lib/ddtrace/configuration/option_definition.rb', line 7 def default @default end |
#depends_on ⇒ Object (readonly)
Returns the value of attribute depends_on.
7 8 9 |
# File 'lib/ddtrace/configuration/option_definition.rb', line 7 def depends_on @depends_on end |
#lazy ⇒ Object (readonly)
Returns the value of attribute lazy.
7 8 9 |
# File 'lib/ddtrace/configuration/option_definition.rb', line 7 def lazy @lazy end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
7 8 9 |
# File 'lib/ddtrace/configuration/option_definition.rb', line 7 def name @name end |
#setter ⇒ Object (readonly)
Returns the value of attribute setter.
7 8 9 |
# File 'lib/ddtrace/configuration/option_definition.rb', line 7 def setter @setter end |
Instance Method Details
#default_value ⇒ Object
22 23 24 |
# File 'lib/ddtrace/configuration/option_definition.rb', line 22 def default_value lazy ? @default.call : @default end |