Forum: Ruby on Rails Viewing all Properties and Methods?

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
F68e4842b0a5487678e26046fdb2fdf3?d=identicon&s=25 softwareengineer 99 (Guest)
on 2006-02-01 06:44
(Received via mailing list)
Hello,

  How can I see all the properties (member variables) and methods
(functions) that are available for an object? Is there a function
similar to PHP's  var_dump in MySQL?

  Many thanks for your assistance.

  Frank
Ff82af3238a57fbd1212832ec1a19f28?d=identicon&s=25 Dylan Stamat (Guest)
on 2006-02-01 08:36
(Received via mailing list)
Hey Frank !

Check out the "Module" class here I believe:
http://www.ruby-doc.org/core/

Object, Module and Class all have a slew of "reflection" type methods...
but
am not sure which one prints "it all out".
Have a look and you'll probably find it.
==
Dylan
F68e4842b0a5487678e26046fdb2fdf3?d=identicon&s=25 softwareengineer 99 (Guest)
on 2006-02-01 09:00
(Received via mailing list)
Thanks Dylan for the resource. I will check it out now.

  Frank

Dylan Stamat <dylans@gmail.com> wrote:  Hey Frank !

Check out the "Module" class here I believe:
http://www.ruby-doc.org/core/

Object, Module and Class all have a slew of "reflection" type methods...
but am not sure which one prints "it all out".
Have a look and you'll probably find it.
==
Dylan


On 1/31/06, softwareengineer 99 <softwareengineer99@yahoo.com  >
wrote:Hello,

  How can I see all the properties (member variables) and methods
(functions) that are available for an object? Is there a function
similar to PHP's  var_dump in MySQL?

  Many thanks for your assistance.

  Frank



---------------------------------

   What are the most popular cars? Find out at   Yahoo! Autos

_______________________________________________
Rails mailing list
Rails@lists.rubyonrails.org
http://lists.rubyonrails.org/mailman/listinfo/rails




  _______________________________________________
Rails mailing list
Rails@lists.rubyonrails.org
http://lists.rubyonrails.org/mailman/listinfo/rails
1f8a2831a8b45f62eee765c96c67747a?d=identicon&s=25 Nickolay Kolev (nmk)
on 2006-02-01 10:52
(Received via mailing list)
>   How can I see all the properties (member variables) and methods
> (functions) that are available for an object? Is there a function
> similar to PHP's  var_dump in MySQL?

You can use the 'methods' and 'instance_variables' methods. :-)

obj.methods
obj.instance_variables

Or in a view <%= debug(obj) %> will give you a nicely formatted YAML
style representation of the object.

--Nicky
Ad7805c9fcc1f13efc6ed11251a6c4d2?d=identicon&s=25 Alex Young (Guest)
on 2006-02-01 13:49
(Received via mailing list)
softwareengineer 99 wrote:
> Hello,
>
> How can I see all the properties (member variables) and methods
> (functions) that are available for an object? Is there a function
> similar to PHP's  var_dump in MySQL?
object.inspect is probably what you're after.
This topic is locked and can not be replied to.