summaryrefslogtreecommitdiff
path: root/sample/dir.rb
diff options
context:
space:
mode:
authorknu <knu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2002-12-19 20:30:05 +0000
committerknu <knu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2002-12-19 20:30:05 +0000
commit913bc18761b5019492c30c0df9af7c5860a23bc3 (patch)
treed891d2e61cd3b7eb00e73b49a533b8ad85bb0fc9 /sample/dir.rb
parentd46e835344bc4d43c804d7b2d66145b80ef0c7e3 (diff)
The use of $_ and ~/RE/ is discouraged.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3182 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'sample/dir.rb')
-rw-r--r--sample/dir.rb6
1 files changed, 4 insertions, 2 deletions
diff --git a/sample/dir.rb b/sample/dir.rb
index 2465c4d68e..b627383946 100644
--- a/sample/dir.rb
+++ b/sample/dir.rb
@@ -2,8 +2,10 @@
# list all files but .*/*~/*.o
dirp = Dir.open(".")
for f in dirp
- $_ = f
- unless (~/^\./ || ~/~$/ || ~/\.o/)
+ case f
+ when /^\./, /~$/, /\.o/
+ # do not print
+ else
print f, "\n"
end
end