Sha256: 8abde7a2efd92d42745165df849feeac28b51fe9f37a55f0686229a279ee4e56

Contents?: true

Size: 571 Bytes

Versions: 9

Compression:

Stored size: 571 Bytes

Contents

module Redcar
  class Treebook
    include Redcar::Observable
    include Redcar::Model
    
    attr_reader :trees
    
    def initialize
      @trees = []
    end
    
    # Add a tree to this treebook
    #
    # @param [Redcar::Tree]
    def add_tree(tree)
      @trees << tree
      notify_listeners(:tree_added, tree)
    end
    
    # Remove a tree from this treebook
    #
    # @param [Redcar::Tree]
    def remove_tree(tree)
      if @trees.include?(tree)
        @trees.delete(tree)
        notify_listeners(:tree_removed, tree)
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
redcar-0.3.7.1 plugins/application/lib/application/treebook.rb
redcar-0.3.7 plugins/application/lib/application/treebook.rb
redcar-0.3.6 plugins/application/lib/application/treebook.rb
redcar-0.3.5 plugins/application/lib/application/treebook.rb
redcar-0.3.4.3 plugins/application/lib/application/treebook.rb
redcar-0.3.4.2 plugins/application/lib/application/treebook.rb
redcar-0.3.4.1 plugins/application/lib/application/treebook.rb
redcar-0.3.4 plugins/application/lib/application/treebook.rb
redcar-0.3.0dev plugins/application/lib/application/treebook.rb