From: Jesse Merriman Date: 2007-04-24T09:59:30+09:00 Subject: Re: glob on a dir object On Monday 23 April 2007 19:29, ruby newbie wrote: > Why does not glob method work on a Directory object created or am I > not using the OO constrcuts the right way? glob is a class method of Dir, not an instance method. irb(main):002:0> Dir::glob('/tmp/zz/a?') => ["/tmp/zz/aa"] If you run 'ri Dir' from the command-line, you can see glob appears under 'Class methods'. Running 'ri Dir::glob' gives example usage. glob returns an array of strings, but if you want Files, you can do this: irb(main):007:0> Dir::glob('/tmp/zz/a*').map { |f| File.new f } => [#, #] (though perhaps there's a better way; I haven't done too much with Dir/File myself..) -- Jesse Merriman jessemerriman@warpmail.net http://www.jessemerriman.com/