Module: LocaleSetter::User

Defined in:
lib/locale_setter/user.rb

Class Method Summary collapse

Class Method Details

.for(user, available) ⇒ Object



13
14
15
16
17
18
# File 'lib/locale_setter/user.rb', line 13

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

.locale_methodObject



20
21
22
# File 'lib/locale_setter/user.rb', line 20

def self.locale_method
  LocaleSetter.config.user_locale_method
end

.locale_method=(method_name) ⇒ Object



24
25
26
27
# File 'lib/locale_setter/user.rb', line 24

def self.locale_method=(method_name)
  warn "Deprecation warning. You should use a new block syntax for configuration."
  LocaleSetter.config.user_locale_method = method_name
end