Class: Planter::Plot
- Inherits:
-
Object
- Object
- Planter::Plot
- Defined in:
- lib/sapling/planter.rb
Overview
In-memory tree
Instance Attribute Summary collapse
-
#branches ⇒ Object
The tree, trunk, and branches.
-
#tree ⇒ Object
The tree, trunk, and branches.
-
#trunk ⇒ Object
The tree, trunk, and branches.
Instance Method Summary collapse
-
#edit_branch(branch_no) ⇒ Object
Edit a branch on the tree.
-
#edit_leaf(branch, leaf) ⇒ Object
Edit a leaf on a branch, grasshopper.
-
#edit_trunk ⇒ Object
Edit the trunk of the tree.
Instance Attribute Details
#branches ⇒ Object
The tree, trunk, and branches
12 13 14 |
# File 'lib/sapling/planter.rb', line 12 def branches @branches end |
#tree ⇒ Object
The tree, trunk, and branches
12 13 14 |
# File 'lib/sapling/planter.rb', line 12 def tree @tree end |
#trunk ⇒ Object
The tree, trunk, and branches
12 13 14 |
# File 'lib/sapling/planter.rb', line 12 def trunk @trunk end |
Instance Method Details
#edit_branch(branch_no) ⇒ Object
Edit a branch on the tree
32 33 34 35 36 37 38 39 40 41 42 43 44 |
# 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) ⇒ Object
Edit a leaf on a branch, grasshopper
50 51 52 |
# File 'lib/sapling/planter.rb', line 50 def edit_leaf(branch, leaf) end |
#edit_trunk ⇒ Object
Edit the trunk of the tree
15 16 17 18 19 20 21 22 23 24 25 26 27 |
# 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 |