I have come to the conclusion that the following syntax makes
more sense for Dir[]/Dir.glob:
Dir["#{FILE}/…/…/lib/**/*.rb"]
(In other words, File.join doesn’t make sense here.)
Why?
In my opinion, it is more readable
After reading dir.c in Ruby’s sources, I would say
that it is at least as portable as the File.join variant.
Others more familiar with the Ruby source already said
that Ruby uses slashes internally on all platforms.
that Ruby uses slashes internally on all platforms.
I think that all unix-influenced programs that I use under
windoze accept either slashes or backslashes.
These definitely do:
unzip, zip, awk, gawk, mawk, less, grep, sed, cat, vile, tail, diff,
strings
(In other words, File.join doesn’t make sense here.)
Why?
In my opinion, it is more readable
Yeah, probably.
After reading dir.c in Ruby’s sources, I would say
that it is at least as portable as the File.join variant.
Others more familiar with the Ruby source already said
that Ruby uses slashes internally on all platforms.
I’m a bit wary to rely on such knowledge about internals. I prefer to
stick with the interfaces.
But then again it might be a bit too much formalism in this case - and
especially for one shot scripts.
It’s more efficient.
Yep, guess so.
Interesting points raised nevertheless.
Kind regards
robert
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.