Module: AWS::Flow::OptionsMethods
- Included in:
- ActivityOptions, WorkflowOptions
- Defined in:
- lib/aws/decider/options.rb
Overview
This module refactors out some of the common methods for the Options classes. Any class including this module should implement make_runtime_key method and default_keys method. default_keys method provides an array of keys that are considered to be the default options for that class. make_runtime_key method converts a passed in default key to it’s corresponding runtime key.
Instance Method Summary collapse
-
#get_default_options ⇒ Hash
Retrieves the default options.
-
#get_full_options ⇒ Hash
Retrieves full options.
-
#get_runtime_options ⇒ Hash
Retrieves the runtime values for the default options.
Instance Method Details
#get_default_options ⇒ Hash
Retrieves the default options.
59 60 61 62 |
# File 'lib/aws/decider/options.rb', line 59 def # Get the default options (default_keys) end |
#get_full_options ⇒ Hash
Retrieves full options. It merges the runtime options with the remaining options
70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 |
# File 'lib/aws/decider/options.rb', line 70 def # Initialize an empty hash = {} # Get all the properties held by this class = self.class.held_properties # Remove the unnecessary options (i.e. options not recognized by swf but # only by flow) from the options_keys array. default_keys.concat([:from_class]).each { |x| .delete(x) } # If the value for an option is held by the class, get it and store it # in a hash .each do |option| [option] = self.send(option) if self.send(option) end # Merge the options_hash with the runtime options .merge(self.) end |
#get_runtime_options ⇒ Hash
Retrieves the runtime values for the default options
41 42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/aws/decider/options.rb', line 41 def = {} # For the default values that are present, convert the default keys into # runtime keys. i.e. remove 'default_' and 'default_task_' from the key # name and merge their values with the default values .each do |key, val| new_key = make_runtime_key(key) new_val = ([new_key]) [new_key] = new_val.empty? ? val : new_val.values.first end end |