Class: OpenStax::Aws::SecretsSpecificationFactory
- Inherits:
-
Object
- Object
- OpenStax::Aws::SecretsSpecificationFactory
- 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
- #format(&block) ⇒ Object
-
#initialize(context) ⇒ SecretsSpecificationFactory
constructor
A new instance of SecretsSpecificationFactory.
- #method_missing(name, *args, &block) ⇒ Object
- #store_attribute(name, *args, &block) ⇒ Object
Constructor Details
#initialize(context) ⇒ SecretsSpecificationFactory
Returns a new instance of SecretsSpecificationFactory.
91 92 93 94 95 |
# File 'lib/openstax/aws/secrets_factory.rb', line 91 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
101 102 103 |
# File 'lib/openstax/aws/secrets_factory.rb', line 101 def method_missing(name, *args, &block) store_attribute(name, *args, &block) end |
Instance Attribute Details
#attributes ⇒ Object (readonly)
Returns the value of attribute attributes.
89 90 91 |
# File 'lib/openstax/aws/secrets_factory.rb', line 89 def attributes @attributes end |
Instance Method Details
#format(&block) ⇒ Object
97 98 99 |
# File 'lib/openstax/aws/secrets_factory.rb', line 97 def format(&block) store_attribute(:format, &block) end |
#store_attribute(name, *args, &block) ⇒ Object
105 106 107 108 109 |
# File 'lib/openstax/aws/secrets_factory.rb', line 105 def store_attribute(name, *args, &block) raise "Secrets specification option `#{name}` cannot be called with arguments, only a block" if !args.empty? raise "Secrets specification option `#{name}` must be called with a block to set the value" if !block_given? attributes[name.to_sym] = @context.instance_eval(&block) end |