Class: AWS::Flow::Options
- Inherits:
-
Object
- Object
- AWS::Flow::Options
- Extended by:
- Utilities::UpwardLookups
- Defined in:
- lib/aws/decider/options.rb
Overview
The base class for all options classes in the AWS Flow Framework for Ruby.
Direct Known Subclasses
ActivityOptions, RetryOptions, SignalWorkflowOptions, WorkerOptions, WorkflowOptions
Class Attribute Summary collapse
-
.default_classes ⇒ Object
The set of default options.
Attributes included from Utilities::UpwardLookups
Attributes included from Utilities::UpwardLookups::InstanceMethods
Class Method Summary collapse
-
.inherited(child) ⇒ Object
Sets the default classes on a child class (a class derived from Options).
Instance Method Summary collapse
-
#get_options(options, extra_to_add = {}) ⇒ Hash
Merges specified options with the set of options already held by the class, and returns the result.
-
#initialize(hash = {}, use_defaults = false) ⇒ Options
constructor
Creates a new Options instance.
- #method_missing(method_name, *args, &block) ⇒ Object private
Methods included from Utilities::UpwardLookups
held_properties, properties, property
Methods included from Utilities::UpwardLookups::InstanceMethods
Constructor Details
#initialize(hash = {}, use_defaults = false) ⇒ Options
Creates a new AWS::Flow::Options instance.
162 163 164 165 166 167 168 169 |
# File 'lib/aws/decider/options.rb', line 162 def initialize(hash={}, use_defaults = false) @precursors ||= [] hash.each_pair do |key, val| if self.methods.map(&:to_sym).include? "#{key}=".to_sym self.send("#{key}=", val) end end end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method_name, *args, &block) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
97 98 99 |
# File 'lib/aws/decider/options.rb', line 97 def method_missing(method_name, *args, &block) return nil end |
Class Attribute Details
.default_classes ⇒ Object
The set of default options. These are used when ‘use_defaults` is set to `true` on #initialize.
117 118 119 |
# File 'lib/aws/decider/options.rb', line 117 def default_classes @default_classes end |
Class Method Details
.inherited(child) ⇒ Object
Sets the default classes on a child class (a class derived from AWS::Flow::Options).
103 104 105 106 107 108 109 110 111 |
# File 'lib/aws/decider/options.rb', line 103 def self.inherited(child) child.precursors ||= [] default_classes = child.ancestors.map do |precursor| if precursor.methods.map(&:to_sym).include? :default_classes precursor.default_classes end end.compact.flatten child.instance_variable_set("@default_classes", default_classes) end |
Instance Method Details
#get_options(options, extra_to_add = {}) ⇒ Hash
Merges specified options with the set of options already held by the class, and returns the result.
135 136 137 138 139 140 141 142 143 144 145 146 147 148 |
# File 'lib/aws/decider/options.rb', line 135 def (, extra_to_add = {}) = self.class.held_properties.compact if .empty? = .select do |option| self.send(option) != nil && self.send(option) != "" end option_values = .map do |option| self.send(option) == Float::INFINITY ? "NONE" : self.send(option) end result = Hash[.zip(option_values)] result.merge(extra_to_add) end |