Open
Conversation
`File::FNM_PATHNAME`は1.8.0から導入されたので`**`は使用できる。 `File::FNM_EXTGLOB`は2.0.0から導入なので残す。
くわしは`File.fnmatch`を参照してもらうことにする
Member
|
$ nerdctl run --rm -it ghcr.io/ruby/all-ruby env LANG=C.UTF-8 ALL_RUBY_SINCE=ruby-1.6 ./all-ruby -e 'p File.fnmatch("/*/*.rb", "/foo/bar/baz.rb"), File.fnmatch("/**/*.rb", "/foo/bar/baz.rb"), File.fnmatch("/*/*.rb", "/foo/bar/baz.rb", File::FNM_PATHNAME), File.fnmatch("/**/*.rb", "/foo/bar/baz.rb", File::FNM_PATHNAME)'
ruby-1.6.0 -e:1: undefined method `fnmatch' for File:Class (NameError)
exit 1
...
ruby-1.6.8 -e:1: undefined method `fnmatch' for File:Class (NameError)
exit 1
ruby-1.8.0 true
true
false
false
...
ruby-1.8.5-p231 true
true
false
false
ruby-1.8.6-preview1 true
true
false
true
...
ruby-3.3.0-preview1 true
true
false
true
とあって、http://blade.ruby-lang.org/ruby-dev/22901 には とあるので、詳しく説明するなら、 |
Contributor
Author
|
いっそfnmatchの"ワイルドカードとして〜"の部分を削除して、オプション定数に説明を委ねるのはいかがでしょう? |
Member
完全に削除してしまうと大まかに知りたいだけの時に不便になりそうなので、 else の方からも |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
File::FNM_PATHNAMEは1.8.0から導入されたので**は使用できるはずです。File::FNM_EXTGLOBは2.0.0から導入なので残します。Pathname#fnmatchおよびPathname#fnmatch?のワイルドカードの記述は厳密にはバージョン分岐するべきですが、File.fnmatchおよび``File#fnmatch?`と二重管理になるので削除し、くわしくは参照を見ていただくのが良いと思います。"[[m:Dir.glob]] とは違って `**/' は使用できません。"は17年前のcommitから入っている文言が今まで引き継がれていたようです。
f6eb655