How does ruby find gems? -


i have installed gem called csapi. ruby -e 'require "csapi"' runs fine. gem env shows /library/ruby/gems/2.0.0 on gem path, , there file /library/ruby/gems/2.0.0/gems/csapi-0.0.5/lib/csapi.rb assume file being loaded when require csapi.

main question: how ruby find file? whole directory structure under /library/ruby/gems/2.0.0 traversed find file called csapi.rb?

side question: there file /library/ruby/gems/2.0.0/gems/csapi-0.0.5/examples/example.rb installed part of gem. can ruby script invoked without typing full path?

you can see paths require traverses typing

ruby -e 'puts $:' 

ok, sorry incomplete, should show gem paths:

ruby -r rubygems -e "p gem.path" 

Comments

Popular posts from this blog

node.js - Using Node without global install -

How to access a php class file from PHPFox framework into javascript code written in simple HTML file? -

java - Null response to php query in android, even though php works properly -