Viewing all Properties and Methods?

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

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

Thanks Dylan for the resource. I will check it out now.

Frank

Dylan S. [email protected] 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 <[email protected] >
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
[email protected]
http://lists.rubyonrails.org/mailman/listinfo/rails


Rails mailing list
[email protected]
http://lists.rubyonrails.org/mailman/listinfo/rails

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. :slight_smile:

obj.methods
obj.instance_variables

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

–Nicky

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.