Module: Multilang::LanguageNames
- Defined in:
- lib/multilang/language_names.rb
Class Method Summary collapse
-
.[](spec) ⇒ String
Convert from the language specifier to the language name.
Class Method Details
.[](spec) ⇒ String
Convert from the language specifier to the language name.
30 31 32 33 34 35 36 37 38 |
# File 'lib/multilang/language_names.rb', line 30 def self.[](spec) map, key = case spec when String then [NAME_MAP, spec] when Symbol then [CODE_MAP, spec.to_s] else raise TypeError, "can't convert #{spec.class} into #{String} or #{Symbol}" end map[key.downcase] or raise ArgumentError, "#{spec.inspect} language specifier does not defined" end |