Class: Simplerubysteps::Task
- Defined in:
- lib/simplerubysteps/model.rb
Instance Attribute Summary
Attributes inherited from State
Instance Method Summary collapse
- #action(&action_block) ⇒ Object
- #implicit_choice ⇒ Object
-
#initialize(name) ⇒ Task
constructor
A new instance of Task.
- #perform_action(input) ⇒ Object
Methods inherited from State
Constructor Details
#initialize(name) ⇒ Task
Returns a new instance of Task.
80 81 82 83 84 85 86 87 88 |
# File 'lib/simplerubysteps/model.rb', line 80 def initialize(name) super @dict[:Type] = "Task" @dict[:Resource] = pop_function_arn @dict[:Parameters] = { :Task => name, "Input.$" => "$", } end |
Instance Method Details
#action(&action_block) ⇒ Object
90 91 92 |
# File 'lib/simplerubysteps/model.rb', line 90 def action(&action_block) @action_block = action_block end |
#implicit_choice ⇒ Object
107 108 109 110 111 112 113 114 |
# File 'lib/simplerubysteps/model.rb', line 107 def implicit_choice unless @implicit_choice @implicit_choice = Choice.new("#{name}_choice") $sm.add @implicit_choice self.next = @implicit_choice end @implicit_choice end |
#perform_action(input) ⇒ Object
94 95 96 97 98 99 100 101 102 103 104 105 |
# File 'lib/simplerubysteps/model.rb', line 94 def perform_action(input) output = input # default: pass through output = @action_block.call(input) if @action_block if @implicit_choice output = {} unless output @implicit_choice.perform_action(output) end output end |