lib/rung/runner/run_context.rb in rung-0.0.1.pre.alpha vs lib/rung/runner/run_context.rb in rung-0.1

- old
+ new

@@ -1,26 +1,43 @@ module Rung module Runner class RunContext - def initialize(steps_definition:, operation_instance:, state:) - @steps_definition = steps_definition + extend Forwardable + + def initialize(operation_instance, state) @operation_instance = operation_instance @state = state @failed = false + @stopped = false end - attr_reader :steps_definition, :operation_instance, :state + def_delegators :operation_class, + :steps_definition, :around_callbacks, + :around_each_callbacks + attr_reader :operation_instance, :state + def operation_class + operation_instance.class + end + def fail! @failed = true end - def failed? - @failed + def stop! + @stopped = true end + def stopped? + @stopped + end + def success? - !failed? + !@failed + end + + def to_state + State.new state, success?, operation_instance end end end end