about summary refs log tree commit diff stats
path: root/code/extensions/basic.rb
diff options
context:
space:
mode:
Diffstat (limited to 'code/extensions/basic.rb')
-rw-r--r--code/extensions/basic.rb14
1 files changed, 5 insertions, 9 deletions
diff --git a/code/extensions/basic.rb b/code/extensions/basic.rb
index f54c3d75..c07402d7 100644
--- a/code/extensions/basic.rb
+++ b/code/extensions/basic.rb
@@ -135,7 +135,7 @@ class Dir
 	end
 end
 
-class File
+class File::Stat
 	MODES_HASH = {
 		'0' => '---',
 		'1' => '--x',
@@ -146,20 +146,16 @@ class File
 		'6' => 'rw-',
 		'7' => 'rwx'
 	}
-	def self.modestr(f)
-		unless exists?(f)
-			return '----------'
-		end
-
-		if symlink?(f)
+	def modestr
+		if symlink?
 			result = 'l'
-		elsif directory?(f)
+		elsif directory?
 			result = 'd'
 		else
 			result = '-'
 		end
 
-		s = ("%o" % File.stat(f).mode)[-3..-1]
+		s = ("%o" % mode)[-3..-1]
 		for m in s.each_char
 			result << MODES_HASH[m]
 		end