((ARGV.length() == 0) ? Dir[“…?* .[^.]* *”] : ARGV).each() do |_|
[…]
And - note the ugly glob pattern. Is there something cleaner for “take
everything from the current directory except . and …”?
how about using “next”:
( ARGV.empty? ? Dir : ARGV ).each() do |_|
next if _ == “.” || _ == “…”
Right, since it isn’t useful or possible at all to rename ‘.’ and ‘…’.
((ARGV.length() == 0) ? Dir[“…?* .[^.]* *”] : ARGV).each() do |_|
[…]
And - note the ugly glob pattern. Is there something cleaner for “take
everything from the current directory except . and …”?
how about using “next”:
( ARGV.empty? ? Dir : ARGV ).each() do |_|
next if _ == “.” || _ == “…”
Right, since it isn’t useful or possible at all to rename ‘.’ and ‘…’.
just out of curiosity: why do you use the variable names “_” and “_2”
instead of “file” or something else which is more obvious? is there any
hidden optimization which i overlooked?
((ARGV.length() == 0) ? Dir[“…?* .[^.]* *”] : ARGV).each() do |_|
[…]
And - note the ugly glob pattern. Is there something cleaner for “take
everything from the current directory except . and …”?
how about using “next”:
( ARGV.empty? ? Dir : ARGV ).each() do |_|
next if _ == “.” || _ == “…”
Right, since it isn’t useful or possible at all to rename ‘.’ and ‘…’.
just out of curiosity: why do you use the variable names “_” and “_2”
instead of “file” or something else which is more obvious? is there any
hidden optimization which i overlooked?
No, in the old version it was less characters to type. Any one-character
variable name would have been OK.
Note it was originally called
rename.rb _.downcase *
Now it can be changed.
···
–
[mpg123d] Just playing: …/08 ame no hi no sugoshikata - new recording.mp3
The math could be slightly incorrect, but it sounds right. RFC 2795