开发者

Ruby package require libraries

开发者 https://www.devze.com 2023-03-07 05:29 出处:网络
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 p

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消