Maintenance Ruby 3.4 gets fixes, but no new features. Switch to Ruby 4.0 →
class method
Dir.[]
(*::path patterns, ?base: ::path?, ?sort: bool) -> ::Array[::String]
Dir[*patterns, base: nil, sort: true] → array
dir.rb
View on GitHub ↗
# File tmp/rubies/ruby-3.4.1/dir.rb, line 222
def self.[](*args, base: nil, sort: true)
Primitive.dir_s_aref(args, base, sort)
end
Calls Dir.glob with argument patterns and the values of keyword arguments base and sort; returns the array of selected entry names.
Ruby version changes
-
3.0
-
Dir.globandDir.[]now sort the results by default, and accept thesort:keyword option. [Feature #8709]
-