module RailwayOperation::Operator::ClassMethods
The operator class method allows classes which include this module to delegate actions to the default operation of the @operations array.
The default operation is a normal RailwayOperation::Operation
classes however it is used to store step declarations as well as other operation attributes such as track_alias, fails_step, etc. If other operations of the class do not declare values for these attributes, the values assigned to the default operation is used.
Public Instance Methods
operation(operation_or_name = :default) { |op| ... }
click to toggle source
# File lib/railway_operation/operator.rb, line 40 def operation(operation_or_name = :default) @operations ||= {} name = Operation.format_name(operation_or_name) op = @operations[name] ||= Operation.new(operation_or_name) # See operation/nested_operation_spec.rb for details for block syntax block_given? ? yield(op) : op end
run(argument, operation: :default, **opts)
click to toggle source
# File lib/railway_operation/operator.rb, line 51 def run(argument, operation: :default, **opts) new.run(argument, operation: operation, **opts) end