relpathname 0.0.1 → 0.0.2

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.
Files changed (3) hide show
  1. checksums.yaml +8 -8
  2. data/lib/relpathname.rb +91 -0
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- YzY2NGM4YjAxNGFhMjUwM2IyZjkwYWZhNjI1ZTMxODUzMTA3YjdlYg==
4
+ MThjMWNkZDJiZTk2NjNhMDc5NDFlZGY3OWQyZTczOWU5YTI2ODEyZg==
5
5
  data.tar.gz: !binary |-
6
- OTgxYTliNGJjOTM4MjBhZGE3Mzc5MGM2NzA4NDA1ZGQ1OTc2NDllYQ==
6
+ ZjlhNGNmMDE1MmM1YzQzNzhjMTY4N2QxOTM4ZjIzZTBhZDZmMTM3Ng==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- ZjI0MTQwMzYzMTkzNjk0YzNjN2EzYjY5N2NkZjlkYjM1ZjZlN2QxNGM3MDYw
10
- Mjk0ODM3ZTM1NDNmZjI3NTVmMDUwMTEzZjdkZjA5MjJkZmY3NzU0MTBlYzA3
11
- ZjkxNGVjZjk5Y2JkMWIxYmQzZTBmMDIxODkxZWJjNWQxMDRiNGE=
9
+ Mzc0M2I0MDY4YmJmNDRiMjgzYjJiNTU2NzhlMmYwM2M0NDVkOGE3MmU3YWMw
10
+ ZWU4OTgyNGI1NzZhZGI2MGQ4OTA1MDQ2MzNkYmJkNjExYzQ3MDNiOTZlMzY4
11
+ YTQ4ZDhiYWZmMWY3NDk2ODg2MjNlYzlmN2E3YTBhODM4NWFmNDU=
12
12
  data.tar.gz: !binary |-
13
- NmMxNjBiZTkwYmZhYjI1Njc0N2VkYjhiN2IxNjE2OGQ4YzIwMjUwNDg3Mjcw
14
- NGJjM2EwMWJiOWY5ZmRmMTkxNDRjNzlmYzI5ZWZmZjA2NzVkN2VmMWUwNWE1
15
- NGYxN2EyODljYzk0YTNiOTJjY2UwZDRkNjE4MzU0YmIzZDM2OWY=
13
+ ZjhkM2FiYWQ1NWQ3MDEzMjMyNDJmMGFhZmIwZDU2MjcyZjIwNTkwOGRkNjZj
14
+ MTZiNDUwZDg0MjQ2MDlkZTRlYmQ0NjgxNTM0MDg0NzhiZDhlZTE3MzgyMzUz
15
+ YWExZGYzODYzMzAwY2EzNDBlN2ViZjFiNWMwNmYwN2IyNTJmODQ=
data/lib/relpathname.rb CHANGED
@@ -1,5 +1,96 @@
1
1
  require 'pathname'
2
2
 
3
3
  class RelPathname < Pathname
4
+ @initial_pwd
5
+
6
+ def initialize p1
7
+ @initial_pwd = Pathname.pwd
8
+
9
+ super p1
10
+ end
11
+
12
+ def to_path
13
+ (@initial_pwd + super).relative_path_from(Pathname.pwd)
14
+ end
15
+
16
+ def to_s
17
+ to_path.to_s
18
+ end
19
+
20
+ def + p1
21
+ RelPathname.new to_path + p1
22
+ end
23
+
24
+ def <=> p1
25
+ to_path <=> p1
26
+ end
27
+
28
+ def == p1
29
+ to_path == p1
30
+ end
31
+
32
+ def === p1
33
+ to_path === p1
34
+ end
35
+
36
+ def absolute?
37
+ to_path.absolute?
38
+ end
39
+
40
+ def basename
41
+ RelPathname.new to_path.basename
42
+ end
43
+
44
+ def children *args
45
+ to_path.children(*args).map do |path| RelPathname.new path end
46
+ end
47
+
48
+ def cleanpath *args
49
+ RelPathname.new to_path.cleanpath(*args)
50
+ end
51
+
52
+ def directory?
53
+ to_path.directory?
54
+ end
55
+
56
+ def dirname
57
+ RelPathname.new to_path.dirname
58
+ end
59
+
60
+ def executable?
61
+ to_path.executable?
62
+ end
63
+
64
+ def executable_real?
65
+ to_path.executable_real?
66
+ end
67
+
68
+ def extname
69
+ RelPathname.new to_path.extname
70
+ end
71
+
72
+ def file?
73
+ to_path.file?
74
+ end
75
+
76
+ def mkpath
77
+ RelPathname.new to_path.mkpath
78
+ end
79
+
80
+ def mtime
81
+ to_path.mtime
82
+ end
83
+
84
+ def parent
85
+ RelPathname.new to_path.parent
86
+ end
87
+
88
+ def relative?
89
+ to_path.relative?
90
+ end
91
+
92
+ def symlink?
93
+ to_path.symlink?
94
+ end
4
95
  end
5
96
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: relpathname
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - A. Levenkov