Sha256: 9603133bfe5ee7d44b05117b6b87502165a6ac5270140228255f86b25e12496d

Contents?: true

Size: 480 Bytes

Versions: 1

Compression:

Stored size: 480 Bytes

Contents

module LocaleSetter
  module User
    @@user_locale_method = :locale

    def self.for(user, available)
      if user && user.respond_to?(locale_method) && 
         user.send(locale_method) && !user.send(locale_method).empty?
        LocaleSetter::Matcher.match user.send(locale_method), available
      end
    end

    def self.locale_method
      @@user_locale_method
    end

    def self.locale_method=(method_name)
      @@user_locale_method = method_name
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
locale_setter-0.3.0 lib/locale_setter/user.rb