planter.rb: Implement branch desc. editing
This commit is contained in:
parent
1af5c9a53c
commit
7b1b0541c1
1 changed files with 14 additions and 4 deletions
|
@ -13,7 +13,7 @@ module Planter
|
||||||
def edit_trunk
|
def edit_trunk
|
||||||
puts "Current Trunk:\n"
|
puts "Current Trunk:\n"
|
||||||
Gardner.display_trunk(@trunk, true)
|
Gardner.display_trunk(@trunk, true)
|
||||||
print "[ =EDITING= ](CTRL-C to abort)> "
|
print "\n[ =EDITING= ](CTRL-C to abort)> "
|
||||||
STDOUT.flush
|
STDOUT.flush
|
||||||
begin
|
begin
|
||||||
new_trunk = STDIN.gets.to_s
|
new_trunk = STDIN.gets.to_s
|
||||||
|
@ -27,8 +27,18 @@ module Planter
|
||||||
# Edit a branch on the tree
|
# Edit a branch on the tree
|
||||||
#
|
#
|
||||||
# @param branch [Integer] The number of the branch to be edited.
|
# @param branch [Integer] The number of the branch to be edited.
|
||||||
def edit_branch(branch)
|
def edit_branch(branch_no)
|
||||||
puts "Edit current branch"
|
puts "Current Branch:\n"
|
||||||
|
Gardner.display_branch(@branches[branch_no], branch_no, true)
|
||||||
|
print "\n[ =EDITING= ](CTRL-C to abort)> "
|
||||||
|
STDOUT.flush
|
||||||
|
begin
|
||||||
|
new_branch = STDIN.gets.to_s
|
||||||
|
rescue Interrupt
|
||||||
|
puts "\n**Aborting edit**\n\n"
|
||||||
|
new_branch = @branches[branch_no]["desc"]
|
||||||
|
end
|
||||||
|
@branches[branch_no]["desc"] = new_branch
|
||||||
end
|
end
|
||||||
|
|
||||||
# Edit a leaf on a branch, grasshopper
|
# Edit a leaf on a branch, grasshopper
|
||||||
|
@ -46,7 +56,7 @@ module Planter
|
||||||
attr_writer :file
|
attr_writer :file
|
||||||
|
|
||||||
def initialize(file)
|
def initialize(file)
|
||||||
@file=file
|
@file = file
|
||||||
end
|
end
|
||||||
|
|
||||||
# Establish and populate a new Plot (in-memory tree), then control the flow
|
# Establish and populate a new Plot (in-memory tree), then control the flow
|
||||||
|
|
Loading…
Reference in a new issue