Ruby:Gemfile中的"require:false"是什么意思? [英] Ruby: What does 'require: false' in Gemfile mean?

查看:82
本文介绍了Ruby:Gemfile中的"require:false"是什么意思?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这样做:

gem 'whenever', require: false

意味着需要安装gem,或者这意味着不需要安装宝石?

mean that the gem needs to be installed, or does it mean it is not required?

推荐答案

这意味着安装gem,但在启动Bundler时不要调用require.因此,您需要手动致电

This means install the gem, but do not call require when you start Bundler. So you will need to manually call

require "whenever"

如果要使用该库.

如果要这样做

gem "whenever", require: "whereever"

然后捆绑程序会随时下载命名的gem,但会调用

then bundler would download the gem named whenever, but would call

require "whereever"

如果要使用的库名称与gem的名称不同,通常使用此方法.

This is often used if the name of library to require is different than the name of the gem.

这篇关于Ruby:Gemfile中的"require:false"是什么意思?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆