[ create a new paste ] login | about

Link: http://codepad.org/3fYDBZME    [ raw code | fork ]

Ruby, pasted on Sep 27:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#I have a Tree Composite Pattern, that
#uses next_node to traverse my tree
#that could be x number of levels deep.

#I would like to modify the below @root_find to
#only return the LOWEST level that has NOT been
#processed, so I need to incorporate min_by some how
#just not sure of the right combination..

#all the tries I have made seem very in-elegant.

#any input would be great!

def next_node() 
     @root.find  { |node| !node.processed } 
end


Output:
No errors or program output.


Create a new paste based on this one


Comments: