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.
99 100 101 102 103 104 105 106 |
# File 'lib/aws/decider/options.rb', line 99 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.
34 35 36 |
# File 'lib/aws/decider/options.rb', line 34 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.
54 55 56 |
# File 'lib/aws/decider/options.rb', line 54 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).
40 41 42 43 44 45 46 47 48 |
# File 'lib/aws/decider/options.rb', line 40 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.
72 73 74 75 76 77 78 79 80 81 82 83 84 85 |
# File 'lib/aws/decider/options.rb', line 72 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 |