parent_paths 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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1a4a0e640330c967e7be13321bc60e72d75b7747
4
- data.tar.gz: 89a646b1e73688a5e3498f8a0fb14dd43cbaa8e6
3
+ metadata.gz: 6783c3c77067649617f46ba80b6637024586f0f8
4
+ data.tar.gz: 8e62049d650768895aa289369bdaf313d64d7333
5
5
  SHA512:
6
- metadata.gz: 95498e8bc02b836ee619c1234209eefac3fd999afbc75ec4a1248b59a92b9a4f57dd27de8e0676b37b3d22c315c2949e183f75ee4af52cfbf25c03e82bafee70
7
- data.tar.gz: 4d9555c784b51b788978ed2f38fbd3031fe9fa66f1b958e47a8fbe1d50d40fc1612d4acc9d3595d98e9de6b6fbc0420369b98eca4b293fd6dcf177bee0100b86
6
+ metadata.gz: 1ff27cdefafbd639daea65a8091ea9196ce9770d580a8d7f3420416760017cdea5324d43daf782a1564facf2de879f9a3bb53ca553a1ed6675334e340c4c24ba
7
+ data.tar.gz: dccc5a2999243a4f73d8c10fc103192af2530b886ec13fa791fc53d53a0b25999ccf91b0f6ae0d1f7c58691084c4b78623c2ef94e38a3b6b42cbede9aa585b8a
@@ -1,3 +1,3 @@
1
1
  module ParentPaths
2
- VERSION = '0.0.1'
2
+ VERSION = '0.0.2'
3
3
  end
data/lib/parent_paths.rb CHANGED
@@ -10,11 +10,10 @@ module ParentPaths
10
10
  # file that calls this method.
11
11
  def self.scan(start = nil, &criteria)
12
12
  start ||= caller_path
13
- start = Pathname.new(start)
14
13
  if criteria.call(start)
15
14
  return start
16
15
  else
17
- parent = start.parent
16
+ parent = Pathname.new(start).parent.to_s
18
17
  if start == parent
19
18
  nil
20
19
  else
@@ -30,7 +29,7 @@ module ParentPaths
30
29
  # file that calls this method.
31
30
  def self.scan_for_owner(filename, start = nil)
32
31
  start ||= caller_path
33
- scan(start) { |pathname| File.exist?(pathname + filename) }
32
+ scan(start) { |path| File.exist?(File.join(path, filename)) }
34
33
  end
35
34
 
36
35
  private
@@ -40,7 +39,7 @@ module ParentPaths
40
39
  # the current file.
41
40
  def self.caller_path
42
41
  matches = caller(2).first.match(/(.*):\d+:in `/)
43
- Pathname.new(File.expand_path(matches[1]))
42
+ File.expand_path(matches[1])
44
43
  end
45
44
 
46
45
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: parent_paths
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
  - Jeff Lee