End of Life Ruby 3.1 has reached end of life and gets no more fixes. Switch to Ruby 4.0 →
class method
Dir.[]
Dir[ string [, string ...] [, base: path] [, sort: true] ] → array
dir.rb
View on GitHub ↗
# File tmp/rubies/ruby-3.1.3/dir.rb, line 127
def self.[](*args, base: nil, sort: true)
Primitive.dir_s_aref(args, base, sort)
end
Equivalent to calling Dir.glob([string,…], 0).
Ruby version changes
-
3.0
-
Dir.globandDir.[]now sort the results by default, and accept thesort:keyword option. [Feature #8709]
-