From 802074a5130aa286c3dd6deac87b3626b0cf30ff Mon Sep 17 00:00:00 2001 From: Bill Niblock Date: Sat, 13 May 2017 15:01:28 -0400 Subject: [PATCH] planter.rb: Utilize display code now in Gardner --- lib/sapling/planter.rb | 19 +++---------------- 1 file changed, 3 insertions(+), 16 deletions(-) diff --git a/lib/sapling/planter.rb b/lib/sapling/planter.rb index ac1f82c..3c3138d 100644 --- a/lib/sapling/planter.rb +++ b/lib/sapling/planter.rb @@ -21,7 +21,7 @@ module Planter def plant @plot = Plot.new @plot.tree = @file - @plot.trunk = @file.shift.values[0] + @plot.trunk = @file.shift @plot.branches = Gardner.prune_branches(@file) dig(1) @@ -35,22 +35,9 @@ module Planter def dig(branch_no) branch = @plot.branches[branch_no] - # Print the trunk - 40.times { print "-" } - puts "\n[ Trunk ]\n#{@plot.trunk}" - 40.times { print "-" } - puts "\n" - 10.times { print "*" } + Gardner.display_trunk(@plot.trunk) + Gardner.display_branch(branch, branch_no, true) - # Print the branch and options - puts "\n[ Branch: #{branch_no} ]" - puts "\n#{branch["desc"]}\n\n" - unless branch["options"].empty? - branch["options"].each_pair do |k,v| - puts "\t#{k}: #{v.keys[0]}" - puts "\t\t [ Goes to branch #{v.values[0]} ]" - end - end end # Edit the trunk of the tree