module Aws::Templates::Utils::Guarded
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.
Constants
- Call
Public Instance Methods
guarded_for(instance, entity) { || ... }
click to toggle source
# 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
Private Instance Methods
trace()
click to toggle source
# File lib/aws/templates/utils/guarded.rb, line 24 def trace Thread.current[Guarded.name] ||= ::Set.new end