Class: DeepCover::Node::Csend
- Inherits:
-
DeepCover::Node
- Object
- DeepCover::Node
- DeepCover::Node::Csend
- Includes:
- Branch
- Defined in:
- lib/deep_cover/node/send.rb
Direct Known Subclasses
Constant Summary
Constants inherited from DeepCover::Node
And, CLASSES, Complex, Cvasgn, Dsym, Erange, Float, Int, Ivar, Kwarg, Kwoptarg, Kwrestarg, OrAsgn, Rational, Sym, True, Zsuper
Instance Attribute Summary
Attributes inherited from DeepCover::Node
#base_node, #children, #index, #next_sibling, #parent, #previous_sibling
Instance Method Summary collapse
- #branches ⇒ Object
- #branches_summary(of = branches) ⇒ Object
- #execution_count ⇒ Object
-
#initialize(base_node, base_children: base_node.children) ⇒ Csend
constructor
A new instance of Csend.
- #message ⇒ Object
Methods included from Branch
Methods inherited from DeepCover::Node
#[], [], atom, #children_nodes, #covered_code, #each_node, #fancy_type, #find_all, has_evaluated_segments, inherited, #to_s, #type
Methods included from Memoize
Constructor Details
#initialize(base_node, base_children: base_node.children) ⇒ Csend
Returns a new instance of Csend.
79 80 81 82 83 |
# File 'lib/deep_cover/node/send.rb', line 79 def initialize(base_node, base_children: base_node.children, **) send_without_receiver = base_node.updated(:safe_send, [nil, *base_node.children.drop(1)]) base_children = [base_children.first, send_without_receiver] super end |
Instance Method Details
#branches ⇒ Object
95 96 97 98 99 |
# File 'lib/deep_cover/node/send.rb', line 95 def branches [TrivialBranch.new(condition: receiver, other_branch: actual_send), actual_send, ] end |
#branches_summary(of = branches) ⇒ Object
101 102 103 104 105 |
# File 'lib/deep_cover/node/send.rb', line 101 def branches_summary(of = branches) of.map do |jump| jump == actual_send ? 'safe send' : 'nil shortcut' end.join(' and ') end |
#execution_count ⇒ Object
87 88 89 |
# File 'lib/deep_cover/node/send.rb', line 87 def execution_count receiver.flow_completion_count end |
#message ⇒ Object
91 92 93 |
# File 'lib/deep_cover/node/send.rb', line 91 def actual_send. end |