Permalink
Browse files

Removed the all_children and self_and_all_children methods - I don't …

…think we need them
  • Loading branch information...
1 parent 409c9c6 commit 9497cad0ef422031674736cd76d023d2c8cb157d @swanandp swanandp committed Apr 2, 2012
@@ -97,24 +97,6 @@ def self_and_siblings
def self_and_children
[self] + self.children
end
-
- # Returns all children (with subchildren) of the node.
- #
- # root.all_children # => [child1, subchild1]
- def all_children
- self.children.inject([]) do |all, child|
- all << child
- subchildren = child.all_children.flatten
- all.concat(subchildren)
- end.flatten
- end
-
- # Returns children (with subchildren) and current node itself.
- #
- # root.self_and_all_children # => [root, child1, subchild1]
- def self_and_all_children
- [self] + self.all_children
- end
end
end
end
@@ -160,15 +160,6 @@ def test_self_and_children
assert_equal [@root2], @root2.self_and_children
end
- def test_all_children
- assert_equal [@root_child1, @root_child2, @child1_child, @child1_child_child] - @root1.all_children, []
- assert_equal @root2.all_children, []
- end
-
- def test_self_and_all_children
- assert_equal [@root1, @root_child1, @root_child2, @child1_child, @child1_child_child] - @root1.self_and_all_children, []
- assert_equal @root2.self_and_all_children - [@root2], []
- end
end
class TreeTestWithEagerLoading < Test::Unit::TestCase

0 comments on commit 9497cad

Please sign in to comment.