diff --git a/lib/pathname_builtin.rb b/lib/pathname_builtin.rb index 878603d..ccc67fc 100644 --- a/lib/pathname_builtin.rb +++ b/lib/pathname_builtin.rb @@ -1092,7 +1092,28 @@ def zero?() FileTest.zero?(@path) end class Pathname # * Dir * - # See Dir.glob. Returns or yields Pathname objects. + + # call-seq: + # Pathname.glob(*args, **kwargs) -> array_of_pathnames + # Pathname.glob(*args, **kwargs) {|pathname| ... } -> nil + # + # Calls Dir.glob(*args, **kwargs), which yields or returns entry names; + # see Dir.glob. + # + # With a block given, calls the block with each pathname + # Pathname.new(entry_name), + # where each +entry_name+ is an entry name yielded by Dir.glob. + # + # a = [] + # Pathname.glob('R*') {|pathname| a << pathname } + # a # => [#, #] + # + # With no block given, returns an array of \Pathname objects; + # each is Pathname.new(entry_name) for an entry name returned by Dir.glob. + # + # Pathname.glob('*').take(3) + # # => [#, #, #] + # def Pathname.glob(*args, **kwargs) # :yield: pathname if block_given? Dir.glob(*args, **kwargs) {|f| yield self.new(f) }