Module: Aws::Templates::Utils::Parametrized::Guarded

Included in:
Aws::Templates::Utils::Parametrized
Defined in:
lib/aws/templates/utils/parametrized/guarded.rb

Overview

Remember Alan Turing’s halting problem and don’t believe in miracles. The method will only work with parameters because they are supposed to be pure unmodifying functions. Hence we can terminate if a parameter method was invoked twice in the stack with the same context.

Defined Under Namespace

Classes: Call

Instance Method Summary collapse

Instance Method Details

#guarded_get(instance, parameter_object) ⇒ Object



15
16
17
18
19
20
21
# File 'lib/aws/templates/utils/parametrized/guarded.rb', line 15

def guarded_get(instance, parameter_object)
  current_call = Call.new(instance, parameter_object)
  return unless trace.add?(current_call)
  ret = parameter_object.get(self)
  trace.delete(current_call)
  ret
end