Ruby on rails 4 Spree-对ViewContext模块感到困惑
任何善良的灵魂都能帮助我了解lib/spree/i18n/base.rb下spree的上述代码吗?如何评估“def self.context=context”?ViewContext模块的用途和用例是什么?提前谢谢Ruby on rails 4 Spree-对ViewContext模块感到困惑,ruby-on-rails-4,internationalization,spree,Ruby On Rails 4,Internationalization,Spree,任何善良的灵魂都能帮助我了解lib/spree/i18n/base.rb下spree的上述代码吗?如何评估“def self.context=context”?ViewContext模块的用途和用例是什么?提前谢谢 module Spree module ViewContext def self.context=(context) @context = context end def self.context @context en
module Spree
module ViewContext
def self.context=(context)
@context = context
end
def self.context
@context
end
def view_context
super.tap do |context|
Spree::ViewContext.context = context
end
end
end
end