Class: Aws::Templates::Utils::Parametrized::RecursiveAdapter
- Defined in:
- lib/aws/templates/utils/parametrized.rb
Overview
Makes parametrized accessible as recursive concept
Instance Attribute Summary collapse
-
#target ⇒ Object
readonly
Returns the value of attribute target.
Instance Method Summary collapse
-
#[](k) ⇒ Object
Index operator.
-
#include?(k) ⇒ Boolean
Check if the key is present in the hash.
-
#initialize(target) ⇒ RecursiveAdapter
constructor
A new instance of RecursiveAdapter.
-
#keys ⇒ Object
Defined hash keys.
Constructor Details
#initialize(target) ⇒ RecursiveAdapter
Returns a new instance of RecursiveAdapter.
167 168 169 |
# File 'lib/aws/templates/utils/parametrized.rb', line 167 def initialize(target) @target = target end |
Instance Attribute Details
#target ⇒ Object (readonly)
Returns the value of attribute target.
143 144 145 |
# File 'lib/aws/templates/utils/parametrized.rb', line 143 def target @target end |
Instance Method Details
#[](k) ⇒ Object
Index operator
Performs intermediate transformation of value if needed (if value is a lambda) and returns it wrapping into Definition instance with the same context if needed (if value is a map)
157 158 159 |
# File 'lib/aws/templates/utils/parametrized.rb', line 157 def [](k) target.parameter_names.include?(k) ? target.send(k) : target.[k] end |
#include?(k) ⇒ Boolean
Check if the key is present in the hash
163 164 165 |
# File 'lib/aws/templates/utils/parametrized.rb', line 163 def include?(k) target.parameter_names.include?(k) || target..include?(k) end |
#keys ⇒ Object
Defined hash keys
147 148 149 |
# File 'lib/aws/templates/utils/parametrized.rb', line 147 def keys target.parameter_names.merge(target..keys) end |