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?

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

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

str.class

Hope that helps.

James Edward G. II

On 01/02/06, John M. [email protected] 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

John M. 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

John M. 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:

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

On

John M. 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