lib/grumlin/steps.rb in grumlin-0.17.0 vs lib/grumlin/steps.rb in grumlin-0.18.0

- old
+ new

@@ -16,11 +16,11 @@ action = action.previous_step end new(shortcuts).tap do |chain| actions.each do |act| - chain.add(act.name, act.arguments) + chain.add(act.name, args: act.args, params: act.params) end end end attr_reader :configuration_steps, :steps, :shortcuts @@ -29,14 +29,14 @@ @shortcuts = shortcuts @configuration_steps = configuration_steps @steps = steps end - def add(name, arguments) - return add_configuration_step(name, arguments) if CONFIGURATION_STEPS.include?(name) + def add(name, args: [], params: {}) + return add_configuration_step(name, args: args, params: params) if CONFIGURATION_STEPS.include?(name) - StepData.new(name, cast_arguments(arguments)).tap do |step| + StepData.new(name, args: cast_arguments(args), params: params).tap do |step| @steps << step end end def uses_shortcuts? @@ -54,19 +54,19 @@ private def shortcuts?(steps_ary) steps_ary.any? do |step| - @shortcuts.include?(step.name) || step.arguments.any? do |arg| + @shortcuts.include?(step.name) || step.args.any? do |arg| arg.is_a?(Steps) ? arg.uses_shortcuts? : false end end end - def add_configuration_step(name, arguments) + def add_configuration_step(name, args: [], params: {}) raise ArgumentError, "cannot use configuration steps after start step was used" unless @steps.empty? - StepData.new(name, cast_arguments(arguments)).tap do |step| + StepData.new(name, args: cast_arguments(args), params: params).tap do |step| @configuration_steps << step end end def cast_arguments(arguments)