epath 0.1.0 → 0.1.1
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.
- data/README.md +4 -0
- data/epath.gemspec +3 -1
- data/lib/epath/fileutils.rb +9 -0
- data/lib/epath/implementation.rb +22 -4
- data/lib/epath/version.rb +3 -0
- metadata +5 -4
data/README.md
CHANGED
@@ -9,6 +9,10 @@ Paths are naturally the subject of their methods and even if they are simple Str
|
|
9
9
|
|
10
10
|
Also, using a path library like this avoid to remember in which class the functionality is implemented, everything is in one place (if not, please open an issue!).
|
11
11
|
|
12
|
+
## Installation
|
13
|
+
|
14
|
+
gem install epath
|
15
|
+
|
12
16
|
## Links
|
13
17
|
|
14
18
|
* [GitHub](https://github.com/eregon/epath)
|
data/epath.gemspec
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
require File.expand_path('../lib/epath/version', __FILE__)
|
2
|
+
|
1
3
|
Gem::Specification.new do |s|
|
2
4
|
s.name = 'epath'
|
3
5
|
s.summary = 'a Path manipulation library'
|
@@ -5,7 +7,7 @@ Gem::Specification.new do |s|
|
|
5
7
|
s.email = 'eregontp@gmail.com'
|
6
8
|
s.homepage = 'https://github.com/eregon/epath'
|
7
9
|
s.files = Dir['lib/**/*.rb'] + %w[README.md LICENSE epath.gemspec]
|
8
|
-
s.version =
|
10
|
+
s.version = Path::VERSION
|
9
11
|
|
10
12
|
s.add_development_dependency 'rspec'
|
11
13
|
end
|
data/lib/epath/fileutils.rb
CHANGED
data/lib/epath/implementation.rb
CHANGED
@@ -20,11 +20,21 @@ class Path
|
|
20
20
|
path.to_s.dup
|
21
21
|
end
|
22
22
|
|
23
|
-
|
23
|
+
init
|
24
|
+
end
|
24
25
|
|
25
|
-
|
26
|
-
@path
|
27
|
-
|
26
|
+
def yaml_initialize(tag, ivars)
|
27
|
+
@path = ivars['path']
|
28
|
+
init
|
29
|
+
end
|
30
|
+
|
31
|
+
def marshal_dump
|
32
|
+
@path
|
33
|
+
end
|
34
|
+
|
35
|
+
def marshal_load path
|
36
|
+
@path = path
|
37
|
+
init
|
28
38
|
end
|
29
39
|
|
30
40
|
# Returns clean path of +self+ with consecutive slashes and useless dots removed.
|
@@ -137,6 +147,14 @@ class Path
|
|
137
147
|
|
138
148
|
private
|
139
149
|
|
150
|
+
def init
|
151
|
+
validate(@path)
|
152
|
+
|
153
|
+
taint if @path.tainted?
|
154
|
+
@path.freeze
|
155
|
+
freeze
|
156
|
+
end
|
157
|
+
|
140
158
|
def validate(path)
|
141
159
|
raise ArgumentError, "path contains a null byte: #{path.inspect}" if path.include? "\0"
|
142
160
|
path.gsub!(File::ALT_SEPARATOR, '/') if File::ALT_SEPARATOR
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: epath
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 25
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 0.1.
|
9
|
+
- 1
|
10
|
+
version: 0.1.1
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- eregon
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2012-03-
|
18
|
+
date: 2012-03-18 00:00:00 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
name: rspec
|
@@ -53,6 +53,7 @@ files:
|
|
53
53
|
- lib/epath/parts.rb
|
54
54
|
- lib/epath/predicates.rb
|
55
55
|
- lib/epath/require_tree.rb
|
56
|
+
- lib/epath/version.rb
|
56
57
|
- lib/epath.rb
|
57
58
|
- README.md
|
58
59
|
- LICENSE
|