pathname2 1.4.3 → 1.4.4

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/CHANGES CHANGED
@@ -1,3 +1,8 @@
1
+ == 1.4.4 - 23-Mar-2006
2
+ * If the path is a symbolic link the Pathname#realpath method
3
+ now returns the absolute path of that link, i.e. the result
4
+ of File.readlink (as a Pathname object).
5
+
1
6
  == 1.4.3 - 3-Mar-2006
2
7
  * Added the Pathname#realpath method.
3
8
 
data/lib/pathname2.rb CHANGED
@@ -77,7 +77,7 @@ class Pathname < String
77
77
  Win32API.new('shlwapi', 'PathRemoveBackslash', 'P', 'P')
78
78
  end
79
79
 
80
- VERSION = '1.4.3'
80
+ VERSION = '1.4.4'
81
81
  MAX_PATH = 260
82
82
 
83
83
  # Creates and returns a new Pathname object.
@@ -117,7 +117,11 @@ class Pathname < String
117
117
  def realpath
118
118
  pwd = Pathname.new(Dir.pwd)
119
119
  File.stat(self) # Check to ensure that the path exists
120
- pwd + self
120
+ if File.symlink?(self)
121
+ Pathname.new(File.readlink(self))
122
+ else
123
+ pwd + self
124
+ end
121
125
  end
122
126
 
123
127
  # Returns the children of the directory, files and subdirectories, as an
data/test/tc_pathname.rb CHANGED
@@ -72,7 +72,7 @@ class TC_Pathname < Test::Unit::TestCase
72
72
  end
73
73
 
74
74
  def test_version
75
- assert_equal("1.4.3", Pathname::VERSION)
75
+ assert_equal("1.4.4", Pathname::VERSION)
76
76
  end
77
77
 
78
78
  def test_realpath
@@ -50,7 +50,7 @@ class TC_Pathname_MSWin < Test::Unit::TestCase
50
50
  end
51
51
 
52
52
  def test_version
53
- assert_equal("1.4.2", Pathname::VERSION)
53
+ assert_equal("1.4.4", Pathname::VERSION)
54
54
  end
55
55
 
56
56
  # Convenience method for test_plus
@@ -82,7 +82,7 @@ class TC_Pathname_MSWin < Test::Unit::TestCase
82
82
  end
83
83
 
84
84
  def test_realpath
85
- assert_respond_to(@abs_path, :realpath)
85
+ assert_respond_to(@fpath, :realpath)
86
86
  assert_equal(@cur_path, Pathname.new('.').realpath)
87
87
  assert_raises(Errno::ENOENT){ Pathname.new('../bogus').realpath }
88
88
  end
metadata CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.8.11
3
3
  specification_version: 1
4
4
  name: pathname2
5
5
  version: !ruby/object:Gem::Version
6
- version: 1.4.3
7
- date: 2006-03-03 00:00:00 -07:00
6
+ version: 1.4.4
7
+ date: 2006-03-23 00:00:00 -07:00
8
8
  summary: An alternate implementation of the Pathname class
9
9
  require_paths:
10
10
  - lib