Class: Sfn::Collection
- Inherits:
-
Object
- Object
- Sfn::Collection
- Includes:
- Singleton
- Defined in:
- lib/sfn/collection.rb
Instance Attribute Summary collapse
-
#all ⇒ Object
readonly
Returns the value of attribute all.
Instance Method Summary collapse
- #add(state_machine) ⇒ Object
- #delete_by_arn(state_machine_arn) ⇒ Object
-
#initialize ⇒ Collection
constructor
A new instance of Collection.
Constructor Details
#initialize ⇒ Collection
Returns a new instance of Collection.
11 12 13 14 15 |
# File 'lib/sfn/collection.rb', line 11 def initialize response = AwsCli.run('stepfunctions', 'list-state-machines', {}) parsed_response = JSON.parse(response) @all = parsed_response['stateMachines'] || [] end |
Instance Attribute Details
#all ⇒ Object (readonly)
Returns the value of attribute all.
9 10 11 |
# File 'lib/sfn/collection.rb', line 9 def all @all end |
Instance Method Details
#add(state_machine) ⇒ Object
17 18 19 |
# File 'lib/sfn/collection.rb', line 17 def add(state_machine) @all.push(state_machine.slice('stateMachineArn', 'name')) end |
#delete_by_arn(state_machine_arn) ⇒ Object
21 22 23 |
# File 'lib/sfn/collection.rb', line 21 def delete_by_arn(state_machine_arn) @all.delete_if { |sf| sf['stateMachineArn'] == state_machine_arn } end |