Class: TIMEx::Configuration
- Inherits:
-
Object
- Object
- TIMEx::Configuration
- Defined in:
- lib/timex/configuration.rb
Overview
Mutable process-wide defaults for #deadline, propagation, telemetry, and clock selection.
Read through configuration; updates should go through configure so in-flight callers never observe a half-mutated instance.
Instance Attribute Summary collapse
-
#auto_check_default ⇒ Object
Returns the value of attribute auto_check_default.
-
#auto_check_interval ⇒ Object
Returns the value of attribute auto_check_interval.
-
#clock ⇒ Object
Returns the value of attribute clock.
-
#default_on_timeout ⇒ Object
Returns the value of attribute default_on_timeout.
-
#default_strategy ⇒ Object
Returns the value of attribute default_strategy.
-
#skew_tolerance_ms ⇒ Object
Returns the value of attribute skew_tolerance_ms.
-
#telemetry_adapter ⇒ Object
Returns the value of attribute telemetry_adapter.
Instance Method Summary collapse
-
#initialize ⇒ void
constructor
Builds defaults aligned with conservative production behavior.
-
#initialize_copy(source) ⇒ void
Duplicates mutable Array/Hash fields after
dupso nested configuration cannot leak mutations across snapshots.
Constructor Details
#initialize ⇒ void
Builds defaults aligned with conservative production behavior.
24 25 26 27 28 29 30 31 32 |
# File 'lib/timex/configuration.rb', line 24 def initialize @default_strategy = :cooperative @default_on_timeout = :raise @auto_check_default = false @auto_check_interval = 1000 @telemetry_adapter = nil @clock = nil @skew_tolerance_ms = Deadline::DEFAULT_SKEW_TOLERANCE_MS end |
Instance Attribute Details
#auto_check_default ⇒ Object
Returns the value of attribute auto_check_default.
18 19 20 |
# File 'lib/timex/configuration.rb', line 18 def auto_check_default @auto_check_default end |
#auto_check_interval ⇒ Object
Returns the value of attribute auto_check_interval.
18 19 20 |
# File 'lib/timex/configuration.rb', line 18 def auto_check_interval @auto_check_interval end |
#clock ⇒ Object
Returns the value of attribute clock.
18 19 20 |
# File 'lib/timex/configuration.rb', line 18 def clock @clock end |
#default_on_timeout ⇒ Object
Returns the value of attribute default_on_timeout.
18 19 20 |
# File 'lib/timex/configuration.rb', line 18 def default_on_timeout @default_on_timeout end |
#default_strategy ⇒ Object
Returns the value of attribute default_strategy.
18 19 20 |
# File 'lib/timex/configuration.rb', line 18 def default_strategy @default_strategy end |
#skew_tolerance_ms ⇒ Object
Returns the value of attribute skew_tolerance_ms.
18 19 20 |
# File 'lib/timex/configuration.rb', line 18 def skew_tolerance_ms @skew_tolerance_ms end |
#telemetry_adapter ⇒ Object
Returns the value of attribute telemetry_adapter.
18 19 20 |
# File 'lib/timex/configuration.rb', line 18 def telemetry_adapter @telemetry_adapter end |
Instance Method Details
#initialize_copy(source) ⇒ void
Current fields are primitives; this is defensive for future container fields.
This method returns an undefined value.
Duplicates mutable Array/Hash fields after dup so nested configuration cannot leak mutations across snapshots.
107 108 109 110 111 112 113 |
# File 'lib/timex/configuration.rb', line 107 def initialize_copy(source) super instance_variables.each do |iv| val = instance_variable_get(iv) instance_variable_set(iv, val.dup) if val.is_a?(Array) || val.is_a?(Hash) end end |