I wanted to share a few things I forgot and recently learned about using 
IRB to explore source code.  

I should also mention that during my talk I did not use any project-wide 
fuzzy searching to find files.  I thought it would be more confusing if we 
did not see where the file was located in the file tree.  When exploring 
the gem I did make heavy use of project-wide searching to find methods, 
etc....

We have an even more efficient way of finding methods in the source code 
when we are playing around with code in IRB.


Here is an example:

# Opens IRB and loads the VCR gem (would be the same as opening IRB and 
immediately typing "require 'vcr'")
irb -r vcr

# Inside our IRB session we can find info about methods using the 
`method(...).source_location`
2.5.3 :007 > *VCR.method(:use_cassette).source_location*
 => ["/Users/benne/.rvm/gems/ruby-2.5.3/gems/vcr-4.0.0/lib/vcr.rb", 178]


Much thanks to Michael Cordell for pointing this IRB feature out.  He also 
wrote a good series about exploring / reading source code here:  
https://blog.mikecordell.com/2017/01/29/reading-ruby-code-rom-preface.html



-- 
-- 
SD Ruby mailing list
sdruby@googlegroups.com
http://groups.google.com/group/sdruby
--- 
You received this message because you are subscribed to the Google Groups "SD 
Ruby" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sdruby+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sdruby/40d42606-61ea-4dad-8574-295a990d296b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to