--001517477fb0349243048bd2ac78 Content-Type: text/plain; charset=ISO-8859-1 On Tue, Jul 20, 2010 at 5:08 PM, James O'Brien <jeob32 / gmail.com> 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) > Because it's a class method, not an instance method. That is, you should use it as follows: File.basename("foo.bar") HTH, Yaser --001517477fb0349243048bd2ac78--