News for hackers. Stuff that matters.
Re:Programming as a Way of Thinking by t0mbstone on Friday May 05, 2017 @05:11PM (#14276880)
That's true. Ruby can often have a lot of magic that is hard to track down.

I solved this problem by using an IDE that has build-in code introspection (RubyMine), and by using tools like the Pry debugger.

Once I figured that out, the whole world of Ruby just opened up in front of me. Any time I am curious about what a method does, I just command-click it and RubyMine jumps to the original source code with documentation in the comments above it.

You can also use the method(:method_name).source_location technique with pry debugger.

But even those tricks won't get through a forest of black magic caused by an author's use of method_missing. That will require you to do some digging. Once you know how method_missing works, though, it's not too difficult.

Nowadays, good Ruby coders avoid using method_missing if at all possible.

There are no comments on this comment yet.