Method: Puppet::Pops::Types::RecursionGuard#with_that
- Defined in:
- lib/puppet/pops/types/recursion_guard.rb
#with_that(instance) {|@state| ... } ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Add the given argument as ‘that’ invoke the given block with the resulting state
60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 |
# File 'lib/puppet/pops/types/recursion_guard.rb', line 60 def with_that(instance) if (@state & SELF_RECURSION_IN_THAT) == 0 tc = that_count @state = @state | SELF_RECURSION_IN_THAT if that_put(instance) if tc < that_count # recursive state detected result = yield(@state) # pop state @state &= ~SELF_RECURSION_IN_THAT @that_map.delete(instance.object_id) return result end end yield(@state) end |