Class: Simplerubysteps::Task
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.
66 67 68 69 70 71 72 73 74 |
# File 'lib/simplerubysteps.rb', line 66 def initialize(name) super @dict[:Type] = "Task" @dict[:Resource] = $FUNCTION_ARN @dict[:Parameters] = { :Task => name, "Input.$" => "$", } end |
Instance Method Details
#action(&action_block) ⇒ Object
76 77 78 |
# File 'lib/simplerubysteps.rb', line 76 def action(&action_block) @action_block = action_block end |
#implicit_choice ⇒ Object
92 93 94 95 96 97 98 99 |
# File 'lib/simplerubysteps.rb', line 92 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
80 81 82 83 84 85 86 87 88 89 90 |
# File 'lib/simplerubysteps.rb', line 80 def perform_action(input) output = nil output = @action_block.call(input) if @action_block if @implicit_choice output = {} unless output @implicit_choice.perform_action(output) end output end |