Created
June 29, 2010 23:17
-
-
Save goyox86/457976 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From 66f823b959e500161e0e6c6c07f2fdb45963e3f4 Mon Sep 17 00:00:00 2001 | |
From: Jose Narvaez <[email protected]> | |
Date: Tue, 29 Jun 2010 18:30:36 -0430 | |
Subject: [PATCH] Fix File#size to conform to specs | |
--- | |
kernel/common/file.rb | 6 +++++- | |
1 files changed, 5 insertions(+), 1 deletions(-) | |
diff --git a/kernel/common/file.rb b/kernel/common/file.rb | |
index d945faf..145e685 100644 | |
--- a/kernel/common/file.rb | |
+++ b/kernel/common/file.rb | |
@@ -726,7 +726,11 @@ class File < IO | |
## | |
# Returns the size of file_name. | |
def self.size(path) | |
- stat(path).size | |
+ if path.is_a? File | |
+ Stat.from_fd(path.fileno).size | |
+ else | |
+ stat(path).size | |
+ end | |
end | |
## | |
-- | |
1.7.0.3 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment