Sha256: 538b62e29796178009313d6fe483c4baebcace8a4de39d44b42ba847cbf3ec92

Contents?: true

Size: 668 Bytes

Versions: 3

Compression:

Stored size: 668 Bytes

Contents

require 'compo/movable'
require 'compo/null_composite'
require 'compo/parent_tracker'

module Compo
  # A simple implementation of a leaf node
  #
  # Leaves have no children, but can be moved to one.  They implement the
  # Composite API, but all additions and removals fail, and the Leaf always
  # reports no children.
  class Leaf < NullComposite
    include Movable
    include ParentTracker
    include UrlReferenceable

    # Initialises the Leaf
    #
    # The Leaf is created with no children, no parent, and no ID.
    #
    # @api  public
    # @example  Creates a new Leaf.
    #   leaf = Leaf.new
    def initialize
      remove_parent
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
compo-0.2.0 lib/compo/leaf.rb
compo-0.1.5 lib/compo/leaf.rb
compo-0.1.4 lib/compo/leaf.rb