Class: ActiveJob::Temporal::Observability::Configuration
- Inherits:
-
Object
- Object
- ActiveJob::Temporal::Observability::Configuration
- Defined in:
- lib/activejob/temporal/observability.rb
Instance Attribute Summary collapse
-
#adapters ⇒ Object
readonly
Returns the value of attribute adapters.
Instance Method Summary collapse
- #adapter(name) ⇒ Object
- #enabled?(name = nil) ⇒ Boolean
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
- #reset! ⇒ Object
- #use(name) {|adapter| ... } ⇒ Object
- #validate! ⇒ Object
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
165 166 167 |
# File 'lib/activejob/temporal/observability.rb', line 165 def initialize @adapters = [] end |
Instance Attribute Details
#adapters ⇒ Object (readonly)
Returns the value of attribute adapters.
163 164 165 |
# File 'lib/activejob/temporal/observability.rb', line 163 def adapters @adapters end |
Instance Method Details
#adapter(name) ⇒ Object
177 178 179 |
# File 'lib/activejob/temporal/observability.rb', line 177 def adapter(name) adapters.find { |registered_adapter| registered_adapter.name == name.to_sym } end |
#enabled?(name = nil) ⇒ Boolean
181 182 183 184 185 |
# File 'lib/activejob/temporal/observability.rb', line 181 def enabled?(name = nil) return adapters.any? unless name !adapter(name).nil? end |
#reset! ⇒ Object
187 188 189 190 |
# File 'lib/activejob/temporal/observability.rb', line 187 def reset! adapters.each(&:stop!) adapters.clear end |
#use(name) {|adapter| ... } ⇒ Object
169 170 171 172 173 174 175 |
# File 'lib/activejob/temporal/observability.rb', line 169 def use(name, **) adapter = Observability.adapter_class(name).new(**) yield adapter if block_given? adapter.start! replace_adapter(adapter) adapter end |
#validate! ⇒ Object
192 193 194 |
# File 'lib/activejob/temporal/observability.rb', line 192 def validate! adapters.each(&:validate!) end |