outstand-sycamore 0.4.0.pre

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,43 @@
1
+ require 'singleton'
2
+
3
+ module Sycamore
4
+ class Path
5
+ ##
6
+ # @api private
7
+ #
8
+ class Root < Path
9
+ include Singleton
10
+
11
+ def initialize
12
+ @parent, @node = nil, nil
13
+ end
14
+
15
+ def up(distance = 1)
16
+ super unless distance.is_a? Integer
17
+ self
18
+ end
19
+
20
+ def root?
21
+ true
22
+ end
23
+
24
+ def length
25
+ 0
26
+ end
27
+
28
+ def join(delimiter = '/')
29
+ ''
30
+ end
31
+
32
+ def to_s
33
+ '#<Path:Root>'
34
+ end
35
+
36
+ def inspect
37
+ '#<Sycamore::Path::Root>'
38
+ end
39
+ end
40
+
41
+ ROOT = Root.instance # @api private
42
+ end
43
+ end
@@ -0,0 +1,4 @@
1
+ require 'sycamore'
2
+
3
+ # optional global shortcut constant for Sycamore::Tree
4
+ STree = Sycamore::Tree