Class: Locomotive::Steam::Liquid::Drops::I18nBase
- Defined in:
- lib/locomotive/steam/liquid/drops/i18n_base.rb
Direct Known Subclasses
Instance Method Summary collapse
- #context=(context) ⇒ Object
-
#initialize(source) ⇒ I18nBase
constructor
A new instance of I18nBase.
Methods inherited from Base
Constructor Details
#initialize(source) ⇒ I18nBase
Returns a new instance of I18nBase.
7 8 9 10 11 12 |
# File 'lib/locomotive/steam/liquid/drops/i18n_base.rb', line 7 def initialize(source) # puts "creating #{self.class.name} drop for #{source.class.name}(#{source.object_id.inspect})" decorated = source if source.respond_to?(:__locale__) decorated ||= Locomotive::Steam::Decorators::I18nDecorator.new(source) super(decorated) end |
Instance Method Details
#context=(context) ⇒ Object
14 15 16 17 18 19 20 21 22 |
# File 'lib/locomotive/steam/liquid/drops/i18n_base.rb', line 14 def context=(context) if locale = context.registers[:locale] @_source.__locale__ = locale end @_source.__default_locale__ = context.registers[:site].try(:default_locale) super end |