Sha256: c4942b923c6f04f68e906591012d30ad032422ce48cbb4d502a67047678fa44a
Contents?: true
Size: 500 Bytes
Versions: 2
Compression:
Stored size: 500 Bytes
Contents
module LocaleSetter module Matcher def self.match(requested, against = available) matched = (sanitize(requested) & against).first matched.to_sym if matched end def self.sanitize(input) if input.respond_to? :map input.map{|l| sanitize_one(l)} else [sanitize_one(input)] end end def self.sanitize_one(locale) locale.to_s.downcase.strip end def self.available I18n.available_locales.map(&:to_s) end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
locale_setter-0.1.1 | lib/locale_setter/matcher.rb |
locale_setter-0.1.0 | lib/locale_setter/matcher.rb |