Module: CMDx
- Extended by:
- CMDx
- Included in:
- CMDx
- Defined in:
- lib/cmdx.rb,
lib/cmdx/task.rb,
lib/cmdx/util.rb,
lib/cmdx/chain.rb,
lib/cmdx/fault.rb,
lib/cmdx/input.rb,
lib/cmdx/retry.rb,
lib/cmdx/errors.rb,
lib/cmdx/inputs.rb,
lib/cmdx/output.rb,
lib/cmdx/result.rb,
lib/cmdx/signal.rb,
lib/cmdx/context.rb,
lib/cmdx/mergers.rb,
lib/cmdx/outputs.rb,
lib/cmdx/railtie.rb,
lib/cmdx/runtime.rb,
lib/cmdx/version.rb,
lib/cmdx/pipeline.rb,
lib/cmdx/retriers.rb,
lib/cmdx/settings.rb,
lib/cmdx/workflow.rb,
lib/cmdx/callbacks.rb,
lib/cmdx/coercions.rb,
lib/cmdx/executors.rb,
lib/cmdx/telemetry.rb,
lib/cmdx/i18n_proxy.rb,
lib/cmdx/validators.rb,
lib/cmdx/deprecation.rb,
lib/cmdx/deprecators.rb,
lib/cmdx/middlewares.rb,
lib/cmdx/logger_proxy.rb,
lib/cmdx/configuration.rb,
lib/cmdx/coercions/date.rb,
lib/cmdx/coercions/hash.rb,
lib/cmdx/coercions/time.rb,
lib/cmdx/coercions/array.rb,
lib/cmdx/coercions/float.rb,
lib/cmdx/deprecators/log.rb,
lib/cmdx/executors/fiber.rb,
lib/cmdx/retriers/linear.rb,
lib/cmdx/coercions/coerce.rb,
lib/cmdx/coercions/string.rb,
lib/cmdx/coercions/symbol.rb,
lib/cmdx/deprecators/warn.rb,
lib/cmdx/executors/thread.rb,
lib/cmdx/mergers/no_merge.rb,
lib/cmdx/coercions/boolean.rb,
lib/cmdx/coercions/complex.rb,
lib/cmdx/coercions/integer.rb,
lib/cmdx/deprecators/error.rb,
lib/cmdx/validators/format.rb,
lib/cmdx/validators/length.rb,
lib/cmdx/coercions/rational.rb,
lib/cmdx/log_formatters/raw.rb,
lib/cmdx/mergers/deep_merge.rb,
lib/cmdx/retriers/fibonacci.rb,
lib/cmdx/validators/absence.rb,
lib/cmdx/validators/numeric.rb,
lib/cmdx/coercions/date_time.rb,
lib/cmdx/log_formatters/json.rb,
lib/cmdx/log_formatters/line.rb,
lib/cmdx/validators/presence.rb,
lib/cmdx/validators/validate.rb,
lib/cmdx/retriers/exponential.rb,
lib/cmdx/retriers/full_random.rb,
lib/cmdx/retriers/half_random.rb,
lib/cmdx/validators/exclusion.rb,
lib/cmdx/validators/inclusion.rb,
lib/cmdx/coercions/big_decimal.rb,
lib/cmdx/log_formatters/logstash.rb,
lib/cmdx/mergers/last_write_wins.rb,
lib/cmdx/retriers/bounded_random.rb,
lib/cmdx/log_formatters/key_value.rb,
lib/cmdx/retriers/decorrelated_jitter.rb
Defined Under Namespace
Modules: LogFormatters, LoggerProxy, Util, Workflow Classes: Callbacks, Chain, Coercions, Configuration, Context, Deprecation, Deprecators, Errors, Executors, Fault, I18nProxy, Input, Inputs, Mergers, Middlewares, Output, Outputs, Pipeline, Railtie, Result, Retriers, Retry, Runtime, Settings, Signal, Task, Telemetry, Validators
Constant Summary collapse
- Error =
Root exception type for the library. Every CMDx-raised exception inherits from this class, so ‘rescue CMDx::Error` (or its alias `CMDx::Exception`) catches anything thrown by the framework without trapping unrelated `StandardError` descendants. Fault is the notable subclass propagated by `execute!`.
Exception = Class.new(StandardError)
- CallbackError =
Raised when an ‘around_execution` callback fails to invoke its continuation, which would otherwise silently skip the task body.
Class.new(Error)
- DefinitionError =
Raised when a task or workflow attempts to define an input where an accessor with the same name already exists.
Class.new(Error)
- DeprecationError =
Raised by Deprecation when a task configured with ‘deprecation(:error)` is executed. Signals that the caller must migrate off the deprecated task before continuing.
Class.new(Error)
- FrozenTaskError =
Raised when a control-flow signal (e.g. ‘skip!`, `fail!`) is thrown against a task that has already completed and been frozen, making further state transitions impossible.
Class.new(Error)
- ImplementationError =
Class.new(Error)
- MiddlewareError =
Raised by the middleware chain when a registered middleware fails to yield to ‘next_link`, which would otherwise silently skip the task body.
Class.new(Error)
- UnknownAccessorError =
Raised by Context in strict mode when accessing a key that was never assigned, preventing silent ‘nil` propagation across task boundaries.
Class.new(Error)
- UnknownEntryError =
Raised when a registry lookup (coercion, validator, middleware, etc.) is performed against a name that has not been registered.
Class.new(Error)
- UnknownLocaleError =
Raised when the configured locale cannot be resolved to a translation file on the i18n load path.
Class.new(Error)
- VERSION =
Gem version. Bumped on release; mirrored in the gemspec.
"2.1.0"
Instance Method Summary collapse
-
#configuration ⇒ Configuration
(also: #config)
The lazily-initialized global configuration.
-
#configure {|Configuration| ... } ⇒ Configuration
Yields the global configuration for mutation.
-
#reset_configuration! ⇒ void
Replaces the global configuration with a fresh instance and invalidates the cached registries on Task and every Task subclass currently in the object space, so new lookups rebuild from the new config.
Instance Method Details
#configuration ⇒ Configuration Also known as: config
Returns the lazily-initialized global configuration.
49 50 51 52 53 |
# File 'lib/cmdx/configuration.rb', line 49 def configuration return @configuration if @configuration @configuration ||= Configuration.new end |
#configure {|Configuration| ... } ⇒ Configuration
Yields the global configuration for mutation.
61 62 63 64 65 |
# File 'lib/cmdx/configuration.rb', line 61 def configure(&) raise ArgumentError, "CMDx.configure requires a block" unless block_given? configuration.tap(&) end |
#reset_configuration! ⇒ void
This method returns an undefined value.
Replaces the global configuration with a fresh instance and invalidates the cached registries on Task and every Task subclass currently in the object space, so new lookups rebuild from the new config. Intended for test setup/teardown.
Walks ‘ObjectSpace.each_object(Class)` once — acceptable for tests but avoid calling it on a hot path.
76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 |
# File 'lib/cmdx/configuration.rb', line 76 def reset_configuration! @configuration = Configuration.new return unless defined?(Task) ivars = %i[ @middlewares @callbacks @coercions @validators @executors @mergers @retriers @deprecators @telemetry ].freeze ObjectSpace.each_object(Class) do |klass| next unless klass <= Task ivars.each do |iv| next unless klass.instance_variable_defined?(iv) klass.instance_variable_set(iv, nil) end end end |