Class: OpenStax::Aws::SecretsSubstitutionsFactory
- Inherits:
-
Object
- Object
- OpenStax::Aws::SecretsSubstitutionsFactory
- Defined in:
- lib/openstax/aws/secrets_factory.rb
Instance Attribute Summary collapse
-
#attributes ⇒ Object
readonly
Returns the value of attribute attributes.
Instance Method Summary collapse
-
#initialize(context) ⇒ SecretsSubstitutionsFactory
constructor
A new instance of SecretsSubstitutionsFactory.
- #method_missing(name, *args, &block) ⇒ Object
Constructor Details
#initialize(context) ⇒ SecretsSubstitutionsFactory
Returns a new instance of SecretsSubstitutionsFactory.
115 116 117 118 119 |
# File 'lib/openstax/aws/secrets_factory.rb', line 115 def initialize(context) raise ArgumentError, "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
121 122 123 124 125 |
# File 'lib/openstax/aws/secrets_factory.rb', line 121 def method_missing(name, *args, &block) raise "Secrets substitition `#{name}` cannot be called with arguments, only a block" if !args.empty? raise "Secrets substitution `#{name}` must be called with a block to set the substitution 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.
113 114 115 |
# File 'lib/openstax/aws/secrets_factory.rb', line 113 def attributes @attributes end |