Sha256: 69db6e28e831f0be68c16b7ffb89c2be37a4a3b292ef0f5786e83a87004787ec

Contents?: true

Size: 308 Bytes

Versions: 3

Compression:

Stored size: 308 Bytes

Contents

module Rosetta
  class LocaleSession
    def locale
      @locale ||= Locale.default_locale
    end

    def locale=(value)
      case value
      when Locale
        @locale = value
      when String, Symbol
        @locale = Locale.find_by(code: value) || Locale.default_locale
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
rosetta-rails-0.2.1 lib/rosetta/locale_session.rb
rosetta-rails-0.2.0 lib/rosetta/locale_session.rb
rosetta-rails-0.1.1 lib/rosetta/locale_session.rb