Module: Stupidedi::Zipper

Defined in:
lib/stupidedi/zipper.rb,
lib/stupidedi/zipper/path.rb,
lib/stupidedi/zipper/root_cursor.rb,
lib/stupidedi/zipper/edited_cursor.rb,
lib/stupidedi/zipper/abstract_cursor.rb,
lib/stupidedi/zipper/dangling_cursor.rb,
lib/stupidedi/zipper/memoized_cursor.rb

Defined Under Namespace

Classes: AbstractCursor, AbstractPath, DanglingCursor, EditedCursor, Hole, MemoizedCursor, RootCursor

Constant Summary collapse

Root =
Class.new(AbstractPath) do

  # @return self
  def parent
    self
  end

  # (see AbstractPath#left)
  def left
    []
  end

  # (see AbstractPath#right)
  def right
    []
  end

  # (see AbstractPath#last?)
  # @return true
  def last?
    true
  end

  # (see AbstractPath#first?)
  # @return true
  def first?
    true
  end

  # (see AbstractPath#depth)
  def depth
    0
  end

  def position
    nil
  end

  # @return [String]
  def inspect
    "root"
  end
end.new

Constructors collapse

Class Method Details

.build(node) ⇒ AbstractCursor

Returns:



20
21
22
# File 'lib/stupidedi/zipper.rb', line 20

def build(node)
  Zipper::RootCursor.new(node)
end