Asp Forum
Home
|
Login
|
Register
|
Search
Forums
>
comp.lang.ruby
How does one determine an objects class?
John Maclean
2/1/2006 4:14:00 PM
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
6 Answers
James Gray
2/1/2006 4:20:00 PM
0
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?
str.class
Hope that helps.
James Edward Gray II
Austin Ziegler
2/1/2006 4:20:00 PM
0
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?
Which object?
-austin
--
Austin Ziegler * halostatue@gmail.com
* Alternate: austin@halostatue.ca
Chris Gernon
2/1/2006 4:22:00 PM
0
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-...
.
Robert Klemme
2/1/2006 4:22:00 PM
0
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
;-)
John Maclean
2/1/2006 4:33:00 PM
0
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
Antonio Cangiano
2/1/2006 4:40:00 PM
0
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.antonioca...
Servizio di avviso nuovi messaggi
Ricevi direttamente nella tua mail i nuovi messaggi per
How does one determine an objects class?
Inserendo la tua e-mail nella casella sotto, riceverai un avviso tramite posta elettronica ogni volta che il motore di ricerca troverà un nuovo messaggio per te
Il servizio è completamente GRATUITO!
x
Login to ForumsZone
Login with Google
Login with E-Mail & Password