ahh, That makes sense now. I get :: and # syntax that I saw in Pragmatic programmer's guide .Thank you Harold & Jesse. On Apr 23, 8:59 pm, Jesse Merriman <jesse.d.merri... / gmail.com> wrote: > 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 } > => [#<File:/tmp/zz/a>, #<File:/tmp/zz/aa>] > > (though perhaps there's a better way; I haven't done too much with Dir/File > myself..) > > -- > Jesse Merriman > jessemerri... / warpmail.nethttp://www.jessemerriman.com/