Class: Contrast::Agent::Patching::Policy::MethodPolicy
- Extended by:
- MethodPolicyExtend
- Defined in:
- lib/contrast/agent/patching/policy/method_policy.rb
Overview
This class is used to map each method to the trigger node that applies to it
Instance Attribute Summary collapse
-
#deadzone_node ⇒ Object
readonly
Returns the value of attribute deadzone_node.
-
#instance_method ⇒ Object
Returns the value of attribute instance_method.
-
#inventory_node ⇒ Object
readonly
Returns the value of attribute inventory_node.
-
#method_name ⇒ Object
Returns the value of attribute method_name.
-
#method_visibility ⇒ Object
Returns the value of attribute method_visibility.
-
#propagation_node ⇒ Object
readonly
Returns the value of attribute propagation_node.
-
#protect_node ⇒ Object
readonly
Returns the value of attribute protect_node.
-
#source_node ⇒ Object
Returns the value of attribute source_node.
-
#trigger_node ⇒ Object
readonly
Returns the value of attribute trigger_node.
Instance Method Summary collapse
- #empty? ⇒ Boolean
-
#initialize(method_policy) ⇒ MethodPolicy
constructor
Initialize new method policy with:.
- #private_method? ⇒ Boolean
- #requires_custom_patch? ⇒ Boolean
- #scopes_to_enter ⇒ Object
- #scopes_to_exit ⇒ Object
Methods included from MethodPolicyExtend
build_method_policy, check_method_policy_nodes_empty?, find_method_node, find_visibility
Constructor Details
#initialize(method_policy) ⇒ MethodPolicy
Initialize new method policy with:
33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/contrast/agent/patching/policy/method_policy.rb', line 33 def initialize method_policy @method_name = method_policy[:method_name] @method_visibility = method_policy[:method_visibility] @instance_method = method_policy[:instance_method] @source_node = method_policy[:source_node] @propagation_node = method_policy[:propagation_node] @trigger_node = method_policy[:trigger_node] @inventory_node = method_policy[:inventory_node] @protect_node = method_policy[:protect_node] @deadzone_node = method_policy[:deadzone_node] end |
Instance Attribute Details
#deadzone_node ⇒ Object (readonly)
Returns the value of attribute deadzone_node.
13 14 15 |
# File 'lib/contrast/agent/patching/policy/method_policy.rb', line 13 def deadzone_node @deadzone_node end |
#instance_method ⇒ Object
Returns the value of attribute instance_method.
14 15 16 |
# File 'lib/contrast/agent/patching/policy/method_policy.rb', line 14 def instance_method @instance_method end |
#inventory_node ⇒ Object (readonly)
Returns the value of attribute inventory_node.
13 14 15 |
# File 'lib/contrast/agent/patching/policy/method_policy.rb', line 13 def inventory_node @inventory_node end |
#method_name ⇒ Object
Returns the value of attribute method_name.
14 15 16 |
# File 'lib/contrast/agent/patching/policy/method_policy.rb', line 14 def method_name @method_name end |
#method_visibility ⇒ Object
Returns the value of attribute method_visibility.
14 15 16 |
# File 'lib/contrast/agent/patching/policy/method_policy.rb', line 14 def method_visibility @method_visibility end |
#propagation_node ⇒ Object (readonly)
Returns the value of attribute propagation_node.
13 14 15 |
# File 'lib/contrast/agent/patching/policy/method_policy.rb', line 13 def propagation_node @propagation_node end |
#protect_node ⇒ Object (readonly)
Returns the value of attribute protect_node.
13 14 15 |
# File 'lib/contrast/agent/patching/policy/method_policy.rb', line 13 def protect_node @protect_node end |
#source_node ⇒ Object
Returns the value of attribute source_node.
14 15 16 |
# File 'lib/contrast/agent/patching/policy/method_policy.rb', line 14 def source_node @source_node end |
#trigger_node ⇒ Object (readonly)
Returns the value of attribute trigger_node.
13 14 15 |
# File 'lib/contrast/agent/patching/policy/method_policy.rb', line 13 def trigger_node @trigger_node end |
Instance Method Details
#empty? ⇒ Boolean
49 50 51 |
# File 'lib/contrast/agent/patching/policy/method_policy.rb', line 49 def empty? nodes.none? end |
#private_method? ⇒ Boolean
45 46 47 |
# File 'lib/contrast/agent/patching/policy/method_policy.rb', line 45 def private_method? method_visibility == :private end |
#requires_custom_patch? ⇒ Boolean
61 62 63 |
# File 'lib/contrast/agent/patching/policy/method_policy.rb', line 61 def requires_custom_patch? !!@trigger_node&.custom_patch? end |
#scopes_to_enter ⇒ Object
53 54 55 |
# File 'lib/contrast/agent/patching/policy/method_policy.rb', line 53 def scopes_to_enter @_scopes_to_enter ||= method_scopes end |
#scopes_to_exit ⇒ Object
57 58 59 |
# File 'lib/contrast/agent/patching/policy/method_policy.rb', line 57 def scopes_to_exit @_scopes_to_exit ||= method_scopes.reverse end |