From: Daniel Bye Date: 2010-07-20T23:39:19+09:00 Subject: Re: File.basename --8w3uRX/HFJGApMzv Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Jul 20, 2010 at 11:08:40PM +0900, James O'Brien wrote: > File.open('myfile') do |f| > puts f.basename; > end >=20 > myfile exists on the filesystem but this code blows up with >=20 > undefined method `basename' >=20 > could someone explain why (given the docs > http://ruby-doc.org/core/classes/File.html > advertise the basename method) It's a class method, not an instance method. File.open('myfile') do |f| puts File.basename(f) end --=20 Daniel Bye _ ASCII ribbon campaign ( ) - against HTML, vCards and X - proprietary attachments in e-mail / \ --8w3uRX/HFJGApMzv Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.15 (FreeBSD) iEYEARECAAYFAkxFtQoACgkQixf5fBYiFmqd0wCg18gF7pE3h19jXeGXa2f6wHjY XbYAn1RfRVYEGZz08KbUMOI6k+Kj6kht =f+s7 -----END PGP SIGNATURE----- --8w3uRX/HFJGApMzv--