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.



170
171
172
# File 'lib/aws/templates/utils/parametrized.rb', line 170

def initialize(target)
  @target = target
end

Instance Attribute Details

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

#include?(k) ⇒ Boolean

Check if the key is present in the hash

Returns:

  • (Boolean)


166
167
168
# File 'lib/aws/templates/utils/parametrized.rb', line 166

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

#keysObject

Defined hash keys



150
151
152
# File 'lib/aws/templates/utils/parametrized.rb', line 150

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