Class: Puppet::Pops::Types::RecursionGuard Private
- Defined in:
- lib/puppet/pops/types/recursion_guard.rb
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Constant Summary collapse
- NO_SELF_RECURSION =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
0
- SELF_RECURSION_IN_THIS =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
1
- SELF_RECURSION_IN_THAT =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
2
- SELF_RECURSION_IN_BOTH =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
3
Instance Attribute Summary collapse
- #state ⇒ Object readonly private
Instance Method Summary collapse
-
#add_that(instance) ⇒ Integer
private
Add the given argument as ‘that’ and return the resulting state.
-
#add_this(instance) ⇒ Integer
private
Add the given argument as ‘this’ and return the resulting state.
-
#initialize ⇒ RecursionGuard
constructor
private
A new instance of RecursionGuard.
-
#recursive_that?(instance) ⇒ Integer
private
Checks if recursion was detected for the given argument in the ‘that’ context.
-
#recursive_this?(instance) ⇒ Integer
private
Checks if recursion was detected for the given argument in the ‘this’ context.
Constructor Details
#initialize ⇒ RecursionGuard
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.
Returns a new instance of RecursionGuard.
19 20 21 |
# File 'lib/puppet/pops/types/recursion_guard.rb', line 19 def initialize @state = NO_SELF_RECURSION end |
Instance Attribute Details
#state ⇒ Object (readonly)
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.
12 13 14 |
# File 'lib/puppet/pops/types/recursion_guard.rb', line 12 def state @state end |
Instance Method Details
#add_that(instance) ⇒ Integer
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’ and return the resulting state
50 51 52 53 54 55 |
# File 'lib/puppet/pops/types/recursion_guard.rb', line 50 def add_that(instance) if (@state & SELF_RECURSION_IN_THAT) == 0 @state = @state | SELF_RECURSION_IN_THAT if map_put(that_map, instance) end @state end |
#add_this(instance) ⇒ Integer
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 ‘this’ and return the resulting state
40 41 42 43 44 45 |
# File 'lib/puppet/pops/types/recursion_guard.rb', line 40 def add_this(instance) if (@state & SELF_RECURSION_IN_THIS) == 0 @state = @state | SELF_RECURSION_IN_THIS if map_put(this_map, instance) end @state end |
#recursive_that?(instance) ⇒ Integer
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.
Checks if recursion was detected for the given argument in the ‘that’ context
33 34 35 |
# File 'lib/puppet/pops/types/recursion_guard.rb', line 33 def recursive_that?(instance) that_map[instance.object_id] == true end |
#recursive_this?(instance) ⇒ Integer
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.
Checks if recursion was detected for the given argument in the ‘this’ context
26 27 28 |
# File 'lib/puppet/pops/types/recursion_guard.rb', line 26 def recursive_this?(instance) this_map[instance.object_id] == true end |