Class: Aws::Templates::Utils::Parametrized::RecursiveAdapter

Inherits:
Object
  • Object
show all
Defined in:
lib/aws/templates/utils/parametrized.rb

Overview

Makes parametrized accessible as recursive concept

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#targetObject (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.options[k]
end

#include?(k) ⇒ Boolean

Check if the key is present in the hash

Returns:

  • (Boolean)


163
164
165
# File 'lib/aws/templates/utils/parametrized.rb', line 163

def include?(k)
  target.parameter_names.include?(k) || target.options.include?(k)
end

#keysObject

Defined hash keys



147
148
149
# File 'lib/aws/templates/utils/parametrized.rb', line 147

def keys
  target.parameter_names.merge(target.options.keys)
end