Module: Aws::Templates::Utils::Guarded
- Included in:
- Default::Definition::Calculable, Parametrized
- Defined in:
- lib/aws/templates/utils/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_for(instance, entity) ⇒ Object
14 15 16 17 18 19 20 |
# File 'lib/aws/templates/utils/guarded.rb', line 14 def guarded_for(instance, entity) current_call = Call.new(instance, entity) return unless trace.add?(current_call) ret = yield trace.delete(current_call) ret end |