Viewing all Properties and Methods?


#1

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


#2

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


#3

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

Frank

Dylan S. removed_email_address@domain.invalid 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 <removed_email_address@domain.invalid >
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
removed_email_address@domain.invalid
http://lists.rubyonrails.org/mailman/listinfo/rails


Rails mailing list
removed_email_address@domain.invalid
http://lists.rubyonrails.org/mailman/listinfo/rails


#4

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


#5

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.