Sha256: e3a821ebfad8966d7140a5b22319220d3e50001d3b4d5ad7e91ae0abc3c9e389

Contents?: true

Size: 284 Bytes

Versions: 1

Compression:

Stored size: 284 Bytes

Contents

class LanguageContext < Contexts::Base
  def key
    :lang
  end

  def constraints
    /ru|en/
  end

  def default
    I18n.default_locale
  end

  def current
    I18n.locale
  end

  def apply(ctrl, value)
    I18n.locale = value || ctrl.params[key].presence || default
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
contexts-0.1.0 spec/dummy/app/contexts/language_context.rb