--0016e656b65e62987d048bd2f32a Content-Type: text/plain; charset=ISO-8859-1 Yep yep silly me... THANKS everyone! On Tue, Jul 20, 2010 at 3:52 PM, Rob Biedenharn <Rob / agileconsultingllc.com>wrote: > On Jul 20, 2010, at 10:08 AM, James O'Brien wrote: > > File.open('myfile') do |f| >> puts f.basename; >> end >> >> myfile exists on the filesystem but this code blows up with >> >> undefined method `basename' >> >> could someone explain why (given the docs >> http://ruby-doc.org/core/classes/File.html >> advertise the basename method) >> >> [ruby 1.8.7 (2010-01-10 patchlevel 249) [i486-linux]] >> >> >> Thanks! >> > > > You're looking at the docs for the class method File.basename, but you're > calling basename on an instance of File referenced by f > > puts File.basename('myfile') > > or better: > > puts File.basename('/some/long/path/to/myfile') > > -Rob > > Rob Biedenharn > Rob / AgileConsultingLLC.com http://AgileConsultingLLC.com/ > rab / GaslightSoftware.com http://GaslightSoftware.com/ > > > --0016e656b65e62987d048bd2f32a--