summaryrefslogtreecommitdiff
path: root/ruby_1_8_5/sample/dir.rb
diff options
context:
space:
mode:
Diffstat (limited to 'ruby_1_8_5/sample/dir.rb')
-rw-r--r--ruby_1_8_5/sample/dir.rb12
1 files changed, 12 insertions, 0 deletions
diff --git a/ruby_1_8_5/sample/dir.rb b/ruby_1_8_5/sample/dir.rb
new file mode 100644
index 0000000000..b627383946
--- /dev/null
+++ b/ruby_1_8_5/sample/dir.rb
@@ -0,0 +1,12 @@
+# directory access
+# list all files but .*/*~/*.o
+dirp = Dir.open(".")
+for f in dirp
+ case f
+ when /^\./, /~$/, /\.o/
+ # do not print
+ else
+ print f, "\n"
+ end
+end
+dirp.close