Class: Simplerubysteps::Task

Inherits:
State
  • Object
show all
Defined in:
lib/simplerubysteps/model.rb

Instance Attribute Summary collapse

Attributes inherited from State

#name, #state_machine

Instance Method Summary collapse

Methods inherited from State

#[]=, #next=, #render

Constructor Details

#initialize(name) ⇒ Task

Returns a new instance of Task.



86
87
88
89
90
91
92
93
94
# File 'lib/simplerubysteps/model.rb', line 86

def initialize(name)
  super
  @dict[:Type] = "Task"
  @dict[:Resource] = pop_function_arn
  @dict[:Parameters] = {
    :Task => name,
    "Input.$" => "$",
  }
end

Instance Attribute Details

#iam_permissionsObject

Returns the value of attribute iam_permissions.



84
85
86
# File 'lib/simplerubysteps/model.rb', line 84

def iam_permissions
  @iam_permissions
end

Instance Method Details

#action(&action_block) ⇒ Object



96
97
98
# File 'lib/simplerubysteps/model.rb', line 96

def action(&action_block)
  @action_block = action_block
end

#implicit_choiceObject



113
114
115
116
117
118
119
120
# File 'lib/simplerubysteps/model.rb', line 113

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



100
101
102
103
104
105
106
107
108
109
110
111
# File 'lib/simplerubysteps/model.rb', line 100

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