Module: Axn::Mountable::MountingStrategies::Step::DSL
- Defined in:
- lib/axn/mountable/mounting_strategies/step.rb
Instance Method Summary collapse
- #step(name, axn_klass = nil, error_prefix: nil, inherit: MountingStrategies::Step.default_inherit_mode, **kwargs) ⇒ Object
- #steps(*steps) ⇒ Object
Instance Method Details
#step(name, axn_klass = nil, error_prefix: nil, inherit: MountingStrategies::Step.default_inherit_mode, **kwargs) ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/axn/mountable/mounting_strategies/step.rb', line 26 def step(name, axn_klass = nil, error_prefix: nil, inherit: MountingStrategies::Step.default_inherit_mode, **kwargs, &) # Steps chain into a shared, accumulating context (see the generated #call): each step is # invoked with all data exposed so far, and its exposures merge back for later steps. MountingStrategies::Step.validate_conditions!(kwargs) Helpers::Mounter.mount_via_strategy( target: self, as: :step, name:, axn_klass:, error_prefix:, inherit:, **kwargs, & ) end |
#steps(*steps) ⇒ Object
16 17 18 19 20 21 22 23 24 |
# File 'lib/axn/mountable/mounting_strategies/step.rb', line 16 def steps(*steps) Array(steps).compact.each do |step_class| next unless step_class.is_a?(Class) raise ArgumentError, "Step #{step_class} must include Axn module" if !step_class.included_modules.include?(::Axn) && !step_class < ::Axn num_steps = _mounted_axn_descriptors.count { |descriptor| descriptor.mount_strategy.key == :step } step("Step #{num_steps + 1}", step_class) end end |