planter.rb: Utilize display code now in Gardner

This commit is contained in:
Bill Niblock 2017-05-13 15:01:28 -04:00
parent 280d016d38
commit 802074a513

View file

@ -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