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

old_branches[R]

Duplicate the “old” trunk and branches, for restoration purposes

old_trunk[R]

Duplicate the “old” trunk and branches, for restoration purposes

trunk[W]

Enable editing for the trunk

Public Class Methods

new() click to toggle source

Initialize a Digiplot just like a Plot, but also copy the trunk and branches to “old” instance variables.

Calls superclass method Gardner::Plot::new
# File lib/sapling/gardner.rb, line 73
def initialize
  super
  @old_trunk = @trunk
  @old_branches = @branches
end

Public Instance Methods

branch=(branch, text) click to toggle source

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
leaf=(branch, leaf, text, target) click to toggle source

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