module RailwayOperation::Operator::DynamicRun

The DynamicRun allows the module which includes it to have a method with that is run_<something>.

ex: run_variation1, run_something, run_my_operation_name

Constants

CAPTURE_OPERATION_NAME

Public Instance Methods

method_missing(method, *args, &block) click to toggle source
Calls superclass method
# File lib/railway_operation/operator.rb, line 20
def method_missing(method, *args, &block)
  return super unless method.match?(CAPTURE_OPERATION_NAME)

  operation = method.match(CAPTURE_OPERATION_NAME)[:operation]
  run(args[0], operation: operation, **(args[1] || {}))
end
respond_to_missing?(method, _include_private = false) click to toggle source
# File lib/railway_operation/operator.rb, line 16
def respond_to_missing?(method, _include_private = false)
  method.match(CAPTURE_OPERATION_NAME)
end