Ruby package require libraries
I'm new to Ruby - came from Java background.
I want to use third party library in my ruby app, but I do not wish to do gem install xxx
. Is that开发者_高级运维 possible? (In java, you add the third party library in your classpath to use it)
Same in Ruby.
require 'lib/yourlibrary.rb'
Or:
$LOAD_PATH << File.expand_path(File.dirname(FILE) + “/../lib”))
require 'yourlibrary.rb'
To include a gem in your project, you could download the module and place it in the same folder as your code and then do a 'require'. You can also download the module with Rubygems copy, or you can download the module from it's project page.
精彩评论