outstand-sycamore 0.4.0.pre
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.dockerignore +12 -0
- data/.editorconfig +24 -0
- data/.gitignore +12 -0
- data/.rspec +6 -0
- data/.travis.yml +16 -0
- data/.yardopts +13 -0
- data/AUTHORS +1 -0
- data/CHANGELOG.md +88 -0
- data/CONTRIBUTING.md +5 -0
- data/CREDITS +0 -0
- data/Deskfile +7 -0
- data/Dockerfile +78 -0
- data/Gemfile +12 -0
- data/Guardfile +11 -0
- data/LICENSE.txt +22 -0
- data/README.md +571 -0
- data/Rakefile +36 -0
- data/VERSION +1 -0
- data/bin/console +7 -0
- data/bin/setup +8 -0
- data/brew-shim +10 -0
- data/compose.yml +35 -0
- data/docker-entrypoint.sh +39 -0
- data/lib/outstand_sycamore.rb +1 -0
- data/lib/sycamore/absence.rb +179 -0
- data/lib/sycamore/exceptions.rb +16 -0
- data/lib/sycamore/extension/nothing.rb +4 -0
- data/lib/sycamore/extension/path.rb +7 -0
- data/lib/sycamore/extension/tree.rb +4 -0
- data/lib/sycamore/extension.rb +2 -0
- data/lib/sycamore/nothing.rb +157 -0
- data/lib/sycamore/path.rb +266 -0
- data/lib/sycamore/path_root.rb +43 -0
- data/lib/sycamore/stree.rb +4 -0
- data/lib/sycamore/tree.rb +1470 -0
- data/lib/sycamore/version.rb +28 -0
- data/lib/sycamore.rb +13 -0
- data/support/doctest_helper.rb +2 -0
- data/support/travis.sh +6 -0
- data/sycamore.gemspec +29 -0
- metadata +154 -0
@@ -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
|