class Planter::Plot

In-memory tree

Attributes

branches[RW]

The tree, trunk, and branches

tree[RW]

The tree, trunk, and branches

trunk[RW]

The tree, trunk, and branches

Public Instance Methods

edit_branch(branch_no) click to toggle source

Edit a branch on the tree

@param branch [Integer] The number of the branch to be edited.

# File lib/sapling/planter.rb, line 32
def edit_branch(branch_no)
  puts "Current Branch:\n"
  Dialogue.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
edit_leaf(branch, leaf) click to toggle source

Edit a leaf on a branch, grasshopper

@param branch [Integer] The number of the branch to be edited. @param leaf [Hash] The leaf hash to be edited.

# File lib/sapling/planter.rb, line 50
def edit_leaf(branch, leaf)

end
edit_trunk() click to toggle source

Edit the trunk of the tree

# File lib/sapling/planter.rb, line 15
def edit_trunk
  puts "Current Trunk:\n"
  Dialogue.display_trunk(@trunk, true)
  print "\n[ =EDITING= ](CTRL-C to abort)> "
  STDOUT.flush
  begin
    new_trunk = STDIN.gets.to_s
  rescue Interrupt
    puts "\n**Aborting edit**\n\n"
    new_trunk = @trunk["trunk"]
  end
  @trunk["trunk"] = new_trunk
end