Sha256: a6310aacef68aa1ce7888b57db60870609361812c85d94b86b1a9295d6bc25a4

Contents?: true

Size: 876 Bytes

Versions: 1

Compression:

Stored size: 876 Bytes

Contents

module Compo
  # A simple implementation of a branch, whose children are stored in an Array
  #
  # An ArrayBranch is a composite object that may be moved into other composite
  # objects.  It stores its children as an Array, and the ID of each child is
  # its current index in the array.  Inserting and removing items into the
  # ArrayBranch may change the IDs of items with higher indices in the array.
  #
  # This is an extension of ArrayComposite to include the Movable and
  # ParentTracker mixins.
  class ArrayBranch < ArrayComposite
    include Movable
    include ParentTracker

    # Initialises the ArrayBranch
    #
    # The ArrayBranch is created with no children, no parent, and no ID.
    #
    # @api  public
    # @example  Creates a new ArrayBranch.
    #   branch = ArrayBranch.new
    def initialize
      super()
      remove_parent
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
compo-0.1.3 lib/compo/array_branch.rb