Commit 900f08ca authored by charlie-ablett's avatar charlie-ablett

Refactor params a bit so they are combined outside the step

parent 5b9dd541
......@@ -9,18 +9,17 @@ module InkStep
include Mixins::HelperMethods
include Mixins::ShellMethods
attr_accessor :next_step, :errors, :status_code, :required_parameters, :process_step,
:started_at, :finished_at, :position, :chain_file_location, :successful, :notes,
:process_log, :execution_parameters, :combined_parameters
attr_accessor :next_step, :errors, :status_code, :process_step, :started_at, :finished_at,
:position, :chain_file_location, :successful, :notes, :process_log,
:required_parameters, :combined_parameters, :accepted_parameters, :default_parameters
INPUT_FILE_DIRECTORY_NAME = "input_files"
OUTPUT_FILE_DIRECTORY_NAME = "output_files"
def initialize(chain_file_location:, position:, next_step: nil, execution_parameters: {})
def initialize(chain_file_location:, position:, next_step: nil)
@position = position
@next_step = next_step
@chain_file_location = chain_file_location
@execution_parameters = execution_parameters
@required_parameters = []
@successful = nil
@errors = []
......@@ -31,6 +30,26 @@ module InkStep
@required_parameters = value
end
def self.accept_parameters(*value)
@accepted_parameters = value
end
def self.set_default_parameters(*value)
@default_parameters = value
end
# Override this method with any parameters the step uses
def accepted_parameters
# e.g. [:foo, :bar]
@accepted_parameters || []
end
# Override this method with default values
def default_values
# e.g. {foo: 1, bar: nil}
@default_parameters || {}
end
def execute(options: {})
@combined_parameters = options || {}
@started_at = Time.now
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment