Ticket #42 (new enhancement)

Opened 9 months ago

[PATCH] add descendant_of? method

Reported by: rails Assigned to: jcm
Priority: major Milestone:
Component: doc Version: trunk
Keywords: Cc:

Description

The attached patch gives you the ability to ask a child if it is a descendant of the passed in node. For example:

child.descendant_of?(root) # => true
child.descendant_of?(parent) # => true
child.descendant_of?(child) # => true

child.descendant_of?(cousin) # => false
child.descendant_of?(someone_elses_parent) # => false
child.descendant_of?(another_root_outside_this_set) # => false

It will return true if the child's left and right values are within the bounds of the passed in node's left and right values. A node is considered a descendant of itself (the bounds checking is inclusive).

Tests have been added. Please commit the patch. If any questions let us know,

  • Ryan Fogle
  • fogle at atomicobject dot com

Attachments

betternestedset.patch (3.8 kB) - added by rails on 02/14/08 19:01:21.
adds descendant_of? method

Change History

02/14/08 19:01:21 changed by rails

  • attachment betternestedset.patch added.

adds descendant_of? method