How does one determine an objects class?

Say I've got
str = IO.read("testfile_for_using_file_open")
how can Idetermone what class this object belongs to?

···

--
John Maclean
MSc (DIC)
07739 171 531

str.class

Hope that helps.

James Edward Gray II

···

On Feb 1, 2006, at 10:13 AM, John Maclean wrote:

Say I've got
str = IO.read("testfile_for_using_file_open")
how can Idetermone what class this object belongs to?

Which object?

-austin

···

On 01/02/06, John Maclean <info@jayeola.org> wrote:

Say I've got
str = IO.read("testfile_for_using_file_open")
how can Idetermone what class this object belongs to?

--
Austin Ziegler * halostatue@gmail.com
               * Alternate: austin@halostatue.ca

John Maclean wrote:

Say I've got
str = IO.read("testfile_for_using_file_open")
how can Idetermone what class this object belongs to?

puts str.class

···

--
Posted via http://www.ruby-forum.com/\.

Thanks chaps! I must say that I am impressed with the speedy reply:)

On

···

Thu, 2 Feb 2006 01:13:56 +0900 John Maclean <info@jayeola.org> wrote:

Say I've got
str = IO.read("testfile_for_using_file_open")
how can Idetermone what class this object belongs to?

--
John Maclean
MSc (DIC)
07739 171 531

John Maclean wrote:

Say I've got
str = IO.read("testfile_for_using_file_open")
how can Idetermone what class this object belongs to?

str is of class String.

    robert

:wink:

John Maclean wrote:

Say I've got str = IO.read("testfile_for_using_file_open")
how can Idetermone what class this object belongs to?

John, you can use the Object#class method.
In your case:

str.class

Use "ri class" for more info.

Cheers,
Antonio

···

--
Antonio Cangiano
My Ruby blog: http://www.antoniocangiano.com