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.
90 91 92 93 94 95 96 97 |
# File 'lib/aws/decider/options.rb', line 90 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.
52 53 54 |
# File 'lib/aws/decider/options.rb', line 52 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 |
# File 'lib/aws/decider/options.rb', line 40 def self.inherited(child) child.precursors ||= [] default_classes = child.ancestors.map do |precursor| precursor.default_classes if precursor.methods.map(&:to_sym).include? :default_classes 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.
70 71 72 73 74 75 76 |
# File 'lib/aws/decider/options.rb', line 70 def (, extra_to_add = {}) = self.class.held_properties.compact if .empty? = .select {|option| self.send(option) != nil && self.send(option) != "" } option_values = .map {|option| self.send(option) == Float::INFINITY ? "NONE" : self.send(option) } result = Hash[.zip(option_values)] result.merge(extra_to_add) end |