summaryrefslogtreecommitdiff
path: root/sample/fullpath.rb
diff options
context:
space:
mode:
Diffstat (limited to 'sample/fullpath.rb')
-rw-r--r--sample/fullpath.rb12
1 files changed, 6 insertions, 6 deletions
diff --git a/sample/fullpath.rb b/sample/fullpath.rb
index ce268e2..252e7dc 100644
--- a/sample/fullpath.rb
+++ b/sample/fullpath.rb
@@ -8,16 +8,16 @@ end
if path == nil
path = ""
-elsif path !~ /\/$/
+elsif path !~ %r|/$|
path += "/"
end
-while gets()
- if /:$/
+while line = gets()
+ case line
+ when /:$/
path = $_.chop.chop + "/"
- elsif /^total/ || /^d/
- elsif /^(.*\d )(.+)$/
+ when /^total/, /^d/
+ when /^(.*\d )(.+)$/
print($1, path, $2, "\n")
end
end
-