Misc #10500
closedImprove Pathname.glob documentation
Description
I was confused by two things about current Pathname.glob
documentation:
Pathname.glob("config/" "*.rb")
#=> [#<Pathname:config/environment.rb>, #<Pathname:config/routes.rb>, ..]
-
"config/" "*.rb"
is not valid syntax - glob pattern should be given only as first argument, second argument
are flags documented withDir.glob
I'm suggesting an update example inspired by those found in
Dir.glob
, making use of File.join
(good practice from my point of
view, encourage not specifying the directory separator):
config_rb_files = File.join('config', '*.rb')
Pathname.glob(config_rb_files)
#=> [#<Pathname:config/environment.rb>, #<Pathname:config/routes.rb>, ...]
I also replaced tabs with spaces on the results line (is there a
policy about this?)
And changed the ellipsis from ..
to ...
, like the others.
I set an assignee, based on what I saw on
https://bugs.ruby-lang.org/projects/ruby/wiki/MaintainersStdlib, hope
I'm correct.
Files
Updated by recursive-madman (Recursive Madman) about 10 years ago
"config/" "*.rb"
Is in fact valid syntax, and equivalent to
"config/*.rb"
Updated by tj (Thibault Jouan) about 10 years ago
My bad! I didn't know about this syntax. This usage here makes perfect
sense, because /*
wouldn't be allowed in the actual C comment for
this method.
None of my other suggested changes are relevant or useful.
Please close this issue and sorry for the noise.
Recursive Madman, thank you for your insight on this.
Updated by nobu (Nobuyoshi Nakada) about 10 years ago
- Status changed from Open to Rejected