Module: Axn::Mountable::MountingStrategies::Step::CallCollisionGuard

Defined in:
lib/axn/mountable/mounting_strategies/step.rb

Overview

Catches a def call written after steps were declared (the reverse order). Prepended to the singleton class — rather than define_singleton_method(:method_added) — so it composes with (and supers into) any method_added the class already defined. It fires only once the orchestrator marker is set, i.e. on a class that generated its own step #call; a mounted child action that merely inherits the marker-less host (e.g. an inherit: step whose ClassBuilder subclasses the host) defines its own #call without tripping it.

Instance Method Summary collapse

Instance Method Details

#method_added(name) ⇒ Object

Raises:

  • (ArgumentError)


92
93
94
95
96
97
98
# File 'lib/axn/mountable/mounting_strategies/step.rb', line 92

def method_added(name)
  super
  return unless name == :call
  return unless instance_variable_defined?(:@_axn_call_method_defined_for_steps) && @_axn_call_method_defined_for_steps

  raise ArgumentError, format(CALL_COLLISION_MESSAGE, self.name || "Action")
end