class Gardner::Digiplot
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.
Attributes
Duplicate the “old” trunk and branches, for restoration purposes
Duplicate the “old” trunk and branches, for restoration purposes
Enable editing for the trunk
Public Class Methods
Initialize a Digiplot
just like a Plot
, but also copy the trunk and branches to “old” instance variables.
Gardner::Plot::new
# File lib/sapling/gardner.rb, line 73 def initialize super @old_trunk = @trunk @old_branches = @branches end
Public Instance Methods
Change a branch
@param branch [Integer] the number of the branch to be edited
# File lib/sapling/gardner.rb, line 82 def branch=(branch, text) @branches[branch]['desc'] = text end
Change a leaf on a branch, grasshopper
@param branch [Integer] the number of the branch to be edited @param leaf [Integer] the number of the leaf to be edited @param text [String] the new text for the leaf @param target [Integer] the branch number target for the leaf option
# File lib/sapling/gardner.rb, line 92 def leaf=(branch, leaf, text, target) @branches[branch]['options'][leaf] = { text => target } end