Class: DeepCover::Node::ShortCircuit
- Inherits:
-
DeepCover::Node
- Object
- DeepCover::Node
- DeepCover::Node::ShortCircuit
- Includes:
- Branch
- Defined in:
- lib/deep_cover/node/short_circuit.rb
Constant Summary
Constants inherited from DeepCover::Node
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
Methods included from Branch
Methods inherited from DeepCover::Node
[], #[], atom, #children_nodes, #covered_code, define_module_class, #each_node, #fancy_type, #find_all, has_evaluated_segments, inherited, #initialize, #simple_literal?, #to_s, #type
Methods included from Memoize
Constructor Details
This class inherits a constructor from DeepCover::Node
Instance Method Details
#branches ⇒ Object
14 15 16 17 18 19 |
# File 'lib/deep_cover/node/short_circuit.rb', line 14 def branches [ conditional, TrivialBranch.new(condition: lhs, other_branch: conditional), ] end |
#branches_summary(of_branches) ⇒ Object
21 22 23 24 25 26 27 28 29 |
# File 'lib/deep_cover/node/short_circuit.rb', line 21 def branches_summary(of_branches) of_branches.map do |jump| if jump == conditional 'right-hand side' else "#{type == :and ? 'falsy' : 'truthy'} shortcut" end end.join(' and ') end |
#operator ⇒ Object
31 32 33 |
# File 'lib/deep_cover/node/short_circuit.rb', line 31 def operator loc_hash[:operator].source.to_sym end |