MattGeri.com

A blog on writing software (mostly Ruby/JS).

Most recent

Count your methods in Ruby

May 5, 2015 / Discussion

This is probably not something that is very useful to do, but just something that I learned about today. If you ever need to count how many methods your object has, then you can just run the following piece of code:

puts object_name.methods.count

Really simple and probably not really useful. Let me know if you ever use this piece of code and what for.

Did you enjoy that post?

Why not subscribe to more posts just like it via email? I'll send all my latest posts to you directly, as they're published. Just fill in your email address below and hit subscribe.

Best of

You can also see a full listing of my best of articles...