lib/todo_next/tree.rb in todo_next-0.0.1 vs lib/todo_next/tree.rb in todo_next-0.0.2

- old
+ new

@@ -1,19 +1,28 @@ require File.dirname(__FILE__) + '/tree/factory' +require File.dirname(__FILE__) + '/tree/visitor/example_remover_visitor' +require File.dirname(__FILE__) + '/tree/visitor/rspec_generator' +require File.dirname(__FILE__) + '/tree/visitor/leaf_maker' module TodoNext - class Tree + attr_accessor :children def initialize @children = [] end def visit(visitor) - children.collect do |node| - visitor.visit(node, level=1) + result = [] + children.each do |node| + result << visitor.visit(node, level=1, parent=self) end + result end - end + def to_rspec + visit(TodoNext::Tree::Visitor::RspecGenerator.new).flatten.join("\n") + end + + end end \ No newline at end of file