lib/contrast/agent/patching/policy/method_policy.rb in contrast-agent-3.8.5 vs lib/contrast/agent/patching/policy/method_policy.rb in contrast-agent-3.9.0

- old
+ new

@@ -29,21 +29,34 @@ def private_method? method_visibility == :private end def empty? - return false if source_node - return false if propagation_node - return false if trigger_node - return false if inventory_node - return false if protect_node - return false if deadzone_node + nodes.none? + end - true + def scopes_to_enter + @_scopes_to_enter ||= method_scopes end + def scopes_to_exit + @_scopes_to_exit ||= method_scopes.reverse + end + def requires_custom_patch? !!@trigger_node&.custom_patch? + end + + private + + def nodes + @_nodes ||= [source_node, propagation_node, trigger_node, inventory_node, protect_node, deadzone_node].compact + end + + def method_scopes + # Implicitly, the scope precedence is the node order + # defined by #nodes. + @_method_scopes ||= nodes.flat_map(&:method_scope).tap(&:compact!).tap(&:uniq!) end class << self # Given a Contrast::Agent::Patching::Policy::ModulePolicy, parse # out its information for the given method in order to construct a