Sha256: e89b63866ddd31de0fa407430ce7a0e2a87d3bca80e5c09bd43b5814aa052446

Contents?: true

Size: 592 Bytes

Versions: 1

Compression:

Stored size: 592 Bytes

Contents

require "singleton"

module Sycamore
  class Path
    ##
    # @api private
    #
    class Root < Path
      include Singleton

      def initialize
        @parent, @node = nil, nil
      end

      def up(distance = 1)
        super unless distance.is_a? Integer
        self
      end

      def root?
        true
      end

      def length
        0
      end

      def join(delimiter = "/")
        ""
      end

      def to_s
        "#<Path:Root>"
      end

      def inspect
        "#<Sycamore::Path::Root>"
      end
    end

    ROOT = Root.instance # @api private
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
metaractor-sycamore-0.4.3 lib/sycamore/path_root.rb