lib/abide_dev_utils/xccdf/parser/objects/numbered_object.rb
# This method will recursively walk the tree to find the first
# child, grandchild, etc. that has a number method and returns the
# matching number.
# @param [String] number The number to find in the tree
# @return [Group] The first child, grandchild, etc. that has a matching number
# @return [Rule] The first child, grandchild, etc. that has a matching number
# @return [nil] If no child, grandchild, etc. has a matching number
This method will recursively walk the tree to find the first
child, grandchild, etc. that has a number method and returns the
matching number.
This method will recursively walk the tree to find the first child grandchild etc . that has a number method and returns the matching number .
def search_children_by_number(number)
            find_children_that_respond_to(:number).find do |child|
              if number_eq(child.number, number)
                child
              elsif number_parent_of?(child.number, number)
                return child.search_children_by_number(number)
              end
            end
          end
def search_children_by_number ( number ) find_children_that_respond_to ( :number ) . find do | child | if number_eq ( child . number , number ) child elsif number_parent_of? ( child . number , number ) return child . search_children_by_number ( number ) end end end
This method will recursively walk the tree to find the first
child, grandchild, etc.
This method will recursively walk the tree to find the first child grandchild etc .
# We recursively search the child for its child with the number # if our number is a parent of the child's number
The first child, grandchild, etc. that has a matching number
The first child grandchild etc . that has a matching number
Group
The first child, grandchild, etc. that has a matching number
The first child grandchild etc . that has a matching number
Rule
If no child, grandchild, etc. has a matching number
If no child grandchild etc . has a matching number
nil
number
number The number to find in the tree
number The number to find in the tree