Class: Gardner::Digiplot
Overview
Digiplot represents a Plot used for editing. The Digiplot functions exactly like a Plot, except with additional functionality for over-writing existing branches, leaves, and the trunk.
Instance Attribute Summary collapse
-
#old_branches ⇒ Object
readonly
Duplicate the “old” trunk and branches, for restoration purposes.
-
#old_trunk ⇒ Object
readonly
Duplicate the “old” trunk and branches, for restoration purposes.
-
#trunk ⇒ Object
writeonly
Enable editing for the trunk.
Attributes inherited from Plot
Instance Method Summary collapse
-
#branch=(branch, text) ⇒ Object
Change a branch.
-
#initialize ⇒ Digiplot
constructor
Initialize a Digiplot just like a Plot, but also copy the trunk and branches to “old” instance variables.
-
#leaf=(branch, leaf, text, target) ⇒ Object
Change a leaf on a branch, grasshopper.
Methods inherited from Plot
#prune_branches, #prune_leaves, #prune_trunk
Constructor Details
#initialize ⇒ Digiplot
Initialize a Digiplot just like a Plot, but also copy the trunk and branches to “old” instance variables.
73 74 75 76 77 |
# File 'lib/sapling/gardner.rb', line 73 def initialize super @old_trunk = @trunk @old_branches = @branches end |
Instance Attribute Details
#old_branches ⇒ Object (readonly)
Duplicate the “old” trunk and branches, for restoration purposes
66 67 68 |
# File 'lib/sapling/gardner.rb', line 66 def old_branches @old_branches end |
#old_trunk ⇒ Object (readonly)
Duplicate the “old” trunk and branches, for restoration purposes
66 67 68 |
# File 'lib/sapling/gardner.rb', line 66 def old_trunk @old_trunk end |
#trunk=(value) ⇒ Object (writeonly)
Enable editing for the trunk
69 70 71 |
# File 'lib/sapling/gardner.rb', line 69 def trunk=(value) @trunk = value end |
Instance Method Details
#branch=(branch, text) ⇒ Object
Change a branch
82 83 84 |
# File 'lib/sapling/gardner.rb', line 82 def branch=(branch, text) @branches[branch]['desc'] = text end |
#leaf=(branch, leaf, text, target) ⇒ Object
Change a leaf on a branch, grasshopper
92 93 94 |
# File 'lib/sapling/gardner.rb', line 92 def leaf=(branch, leaf, text, target) @branches[branch]['options'][leaf] = { text => target } end |