Class: Aws::Templates::Utils::Parametrized::RecursiveAdapter
- Inherits:
-
Object
- Object
- 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.
170 171 172 |
# File 'lib/aws/templates/utils/parametrized.rb', line 170 def initialize(target) @target = target end |
Instance Attribute Details
#target ⇒ Object (readonly)
Returns the value of attribute target.
146 147 148 |
# File 'lib/aws/templates/utils/parametrized.rb', line 146 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)
160 161 162 |
# File 'lib/aws/templates/utils/parametrized.rb', line 160 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
166 167 168 |
# File 'lib/aws/templates/utils/parametrized.rb', line 166 def include?(k) target.parameter_names.include?(k) || target..include?(k) end |
#keys ⇒ Object
Defined hash keys
150 151 152 |
# File 'lib/aws/templates/utils/parametrized.rb', line 150 def keys target.parameter_names.merge(target..keys) end |