relpathname 0.0.4 → 0.0.5
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.
- checksums.yaml +8 -8
- data/lib/relpathname.rb +26 -21
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
NmQ1ZTY4ZGYwNTgyZDkyNmFhYjg1ZGE2Y2JhYmZmYjkwY2YwMWU5Mw==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
YzdkMWQ4M2U5NWM1ZDM1MDVlYzhiYWMyMmM5ZDRlNTBlMTBlMTJlNg==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
NzI4MTNiOWM0OThiNmI3MTEyMTRkMWE3NGJhZGE4MzE3YjliZWFkMjI5NDk4
|
10
|
+
ODFmNTU4YWI3YWVjZDlhNDFiY2NlNjkyMTdjY2UyYTU5ZGIzMjJlNWIwZDgz
|
11
|
+
NWJkZjYyMzdlMWYzOTIyNTUwYWZjNGYwNDg4OTE4NDc2ZDBiYWI=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
OWMxYThiZjRjODIyYmI0ZDQ3NTNkMmJmYjU1MzFlMjA0MWQ1N2Q1MzNjODRi
|
14
|
+
Mzk2MzEyNmIyY2ZjYmY2NTgwMjFiZmUyM2U4ODEwZTA2ODgzODFlNWY3ZjE4
|
15
|
+
Yzg2ZWNiN2JkYWIzMDkxMzJkM2YxZjgxMmViMjhiNjg1YzgwZWY=
|
data/lib/relpathname.rb
CHANGED
@@ -9,89 +9,94 @@ class RelPathname < Pathname
|
|
9
9
|
super p1
|
10
10
|
end
|
11
11
|
|
12
|
+
def to_pn
|
13
|
+
Pathname.new to_path
|
14
|
+
end
|
15
|
+
|
12
16
|
def to_path
|
13
17
|
(@initial_pwd + super).relative_path_from(Pathname.pwd).to_s
|
14
18
|
end
|
15
19
|
|
20
|
+
|
16
21
|
def to_s
|
17
|
-
prefix =
|
18
|
-
prefix + to_path
|
22
|
+
prefix = to_pn.each_filename.to_a[0] == '..' ? '' : './'
|
23
|
+
prefix + to_path
|
19
24
|
end
|
20
25
|
|
21
26
|
def + p1
|
22
|
-
RelPathname.new
|
27
|
+
RelPathname.new to_pn + p1
|
23
28
|
end
|
24
29
|
|
25
30
|
def <=> p1
|
26
|
-
|
31
|
+
to_pn <=> p1
|
27
32
|
end
|
28
33
|
|
29
34
|
def == p1
|
30
|
-
|
35
|
+
to_pn == p1
|
31
36
|
end
|
32
37
|
|
33
38
|
def === p1
|
34
|
-
|
39
|
+
to_pn === p1
|
35
40
|
end
|
36
41
|
|
37
42
|
def absolute?
|
38
|
-
|
43
|
+
to_pn.absolute?
|
39
44
|
end
|
40
45
|
|
41
46
|
def basename
|
42
|
-
RelPathname.new
|
47
|
+
RelPathname.new to_pn.basename
|
43
48
|
end
|
44
49
|
|
45
50
|
def children *args
|
46
|
-
|
51
|
+
to_pn.children(*args).map do |path| RelPathname.new path end
|
47
52
|
end
|
48
53
|
|
49
54
|
def cleanpath *args
|
50
|
-
RelPathname.new
|
55
|
+
RelPathname.new to_pn.cleanpath(*args)
|
51
56
|
end
|
52
57
|
|
53
58
|
def directory?
|
54
|
-
|
59
|
+
to_pn.directory?
|
55
60
|
end
|
56
61
|
|
57
62
|
def dirname
|
58
|
-
RelPathname.new
|
63
|
+
RelPathname.new to_pn.dirname
|
59
64
|
end
|
60
65
|
|
61
66
|
def executable?
|
62
|
-
|
67
|
+
to_pn.executable?
|
63
68
|
end
|
64
69
|
|
65
70
|
def executable_real?
|
66
|
-
|
71
|
+
to_pn.executable_real?
|
67
72
|
end
|
68
73
|
|
69
74
|
def extname
|
70
|
-
RelPathname.new
|
75
|
+
RelPathname.new to_pn.extname
|
71
76
|
end
|
72
77
|
|
73
78
|
def file?
|
74
|
-
|
79
|
+
to_pn.file?
|
75
80
|
end
|
76
81
|
|
77
82
|
def mkpath
|
78
|
-
RelPathname.new
|
83
|
+
RelPathname.new to_pn.mkpath
|
79
84
|
end
|
80
85
|
|
81
86
|
def mtime
|
82
|
-
|
87
|
+
to_pn.mtime
|
83
88
|
end
|
84
89
|
|
85
90
|
def parent
|
86
|
-
RelPathname.new
|
91
|
+
RelPathname.new to_pn.parent
|
87
92
|
end
|
88
93
|
|
89
94
|
def relative?
|
90
|
-
|
95
|
+
to_pn.relative?
|
91
96
|
end
|
92
97
|
|
93
98
|
def symlink?
|
94
|
-
|
99
|
+
to_pn.symlink?
|
95
100
|
end
|
96
101
|
end
|
97
102
|
|