开发者

Rails.env implementation in Rails question

开发者 https://www.devze.com 2023-01-15 21:01 出处:网络
browsing rails source, I found in railties/lib/initializers.rb such method def env @_env ||= begin require \'active_support/string_inquirer\'

browsing rails source, I found in railties/lib/initializers.rb such method

def env
  @_env ||= begin
    require 'active_support/string_inquirer'
    ActiveSupport::StringInquirer.new(RAILS_ENV)
  end
end

I know how it works, but why it is i开发者_如何学JAVAmplementing this way? Only for lazy loading, or maybe there are other reasons?

0

精彩评论

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

关注公众号