lib/jumoku/builders/arborescence.rb
# Check whether a node is a parent. If another node is provided as second
# parameter, check whether the former is the parent of the latter.
#
# @overload parent?(node)
#   @param [Node] node
#   @return [true, false]
# @overload parent?(node, maybe_child)
#   @param [Node] node
#   @param [Node] maybe_child
#   @return [true, false]
#
Check whether a node is a parent. If another node is provided as second
parameter, check whether the former is the parent of the latter.
Check whether a node is a parent . If another node is provided as second parameter check whether the former is the parent of the latter .
def parent?(node, maybe_child = nil)
      if maybe_child.nil?
        !offsprings(node).empty?
      else
        offsprings(node).include? maybe_child
      end
    end
def parent? ( node , maybe_child = nil ) if maybe_child . nil? ! offsprings ( node ) . empty? else offsprings ( node ) . include? maybe_child end end
Check whether a node is a parent.
Check whether a node is a parent .
node
<not_specific>
maybe_child
<not_specific>
overload
parent?(node) @param [Node] node @return [true, false]
parent? ( node ) @param [ Node ] node @return [ true false ]
overload
parent?(node, maybe_child) @param [Node] node @param [Node] maybe_child @return [true, false]
parent? ( node maybe_child ) @param [ Node ] node @param [ Node ] maybe_child @return [ true false ]