views:

83

answers:

2

How do you examine the source code for a library you are using and want to modify.

Eg. when you have downloaded a gem, I guess that you are forking the repo from GitHub and then cloning your forked repo.

So now you have:

  • the local repo's source code (which you open with IDE/text editor)
  • the source code on GitHub (which you browse online)
  • the API doc (which usually lies at rdoc.info)

Which one are you examining to understand the source code?

Apparently you have to modify the local repo's source code through your IDE/text editor. So maybe that one is better than browsing from GitHub.

Do you also read the online API doc at rdoc.info since the comments now are parsed and displayed nicely?

Tell me how your process is, in detail, cause it's a difficult skill to learn for beginners like me.

+1  A: 

I typically start out by examining the source from the installed gem. Documentation can be viewed by running gem server, but sites like rubydoc.info are great too. Github is nice to get a feel for the code, but if I'm going to be really studying it I need to work locally so that I can grep the code, use ctags, etc.

cam
+1  A: 

gem which 'gem_name' will show you your ruby copy. Of course, if you want to save your changes you'll probably want to fork their github repo, then use that code by cloneing out and installing it from there to your local ruby or what not.

rogerdpack