美文网首页
gem 'whenever', '0.9.4', require

gem 'whenever', '0.9.4', require

作者: 陈威严 | 来源:发表于2020-05-15 15:48 被阅读0次

    gem requite: false

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

    
    require "whenever"
    
    

    if you want to use the library.

    If you were to do

    
    gem "whenever", require: "whereever"
    
    

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

    
    require "whereever"
    
    

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

    Is this done for performance reasons? – Venkat D. May 7 '12 at 18:50

    @VenkatD. sometimes you want to install certain gems but you don't want to load them in to every process. I have a particular rake task that I want to invoke periodically on Heroku through their schedular add-on. This particular rake task requires certain gems that the rest of the application doensn't need. So I :require => false these particular gems and explicitly require "thegem" from the rake task. This would then save memory in the main app processes and startup time etc. App performance, however, should not be affected even if you require these additional gems in every process.

    参考链接

    https://stackoverflow.com/questions/4800721/what-does-require-false-in-gemfile-mean

    https://ruby-china.org/topics/32678

    相关文章

      网友评论

          本文标题:gem 'whenever', '0.9.4', require

          本文链接:https://www.haomeiwen.com/subject/ztwcohtx.html