Class: OpenStax::Aws::StackFactory::VolatileParametersFactory
- Inherits:
-
Object
- Object
- OpenStax::Aws::StackFactory::VolatileParametersFactory
- Defined in:
- lib/openstax/aws/stack_factory.rb
Instance Attribute Summary collapse
-
#attributes ⇒ Object
readonly
Returns the value of attribute attributes.
Instance Method Summary collapse
-
#initialize(context) ⇒ VolatileParametersFactory
constructor
A new instance of VolatileParametersFactory.
- #method_missing(name, *args, &block) ⇒ Object
Constructor Details
#initialize(context) ⇒ VolatileParametersFactory
Returns a new instance of VolatileParametersFactory.
143 144 145 146 147 |
# File 'lib/openstax/aws/stack_factory.rb', line 143 def initialize(context) raise "context cannot be nil" if context.nil? @context = context @attributes = {} end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(name, *args, &block) ⇒ Object
149 150 151 152 153 |
# File 'lib/openstax/aws/stack_factory.rb', line 149 def method_missing(name, *args, &block) raise "Volatile parameter `#{name}` cannot be called with arguments, only a block" if !args.empty? raise "Volatile parameter `#{name}` must be called with a block to set the parameter value" if !block_given? attributes[name.to_sym] = @context.instance_eval(&block) end |
Instance Attribute Details
#attributes ⇒ Object (readonly)
Returns the value of attribute attributes.
141 142 143 |
# File 'lib/openstax/aws/stack_factory.rb', line 141 def attributes @attributes end |