Class: DeepCover::Node::Case

Inherits:
DeepCover::Node show all
Includes:
Branch
Defined in:
lib/deep_cover/node/case.rb

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

Methods included from Branch

#flow_completion_count

Methods inherited from DeepCover::Node

[], #[], atom, #children_nodes, #covered_code, #each_node, #fancy_type, #find_all, has_evaluated_segments, inherited, #initialize, #to_s, #type

Methods included from Memoize

#freeze, included

Constructor Details

This class inherits a constructor from DeepCover::Node

Instance Method Details

#branchesObject



88
89
90
# File 'lib/deep_cover/node/case.rb', line 88

def branches
  whens.map(&:body) << self.else
end

#execution_countObject



92
93
94
95
# File 'lib/deep_cover/node/case.rb', line 92

def execution_count
  return evaluate.flow_completion_count if evaluate
  flow_entry_count
end

#has_else?Boolean

Returns:

  • (Boolean)


97
98
99
# File 'lib/deep_cover/node/case.rb', line 97

def has_else?
  !!base_node.loc.to_hash[:else]
end