Sha256: 6d3f1f83520661c79426a7e08133a6b04ddb8bd8a619c81bcf5cf2a84b6f4f13

Contents?: true

Size: 592 Bytes

Versions: 9

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

9 entries across 9 versions & 3 rubygems

Version Path
metaractor-sycamore-0.4.2 lib/sycamore/path_root.rb
metaractor-sycamore-0.4.1 lib/sycamore/path_root.rb
outstand-sycamore-0.4.0 lib/sycamore/path_root.rb
outstand-sycamore-0.4.0.pre lib/sycamore/path_root.rb
sycamore-0.3.1 lib/sycamore/path_root.rb
sycamore-0.3.0 lib/sycamore/path_root.rb
sycamore-0.2.1 lib/sycamore/path_root.rb
sycamore-0.2.0 lib/sycamore/path_root.rb
sycamore-0.1.0 lib/sycamore/path_root.rb