Class: Locale::TagList
- Inherits:
-
Array
- Object
- Array
- Locale::TagList
- Includes:
- Util::Memoizable
- Defined in:
- lib/locale/taglist.rb
Overview
This provides the subclass of Array which behaves like the first(top priority) Locale::Tag object. “Locale.current.language” is same with “Locale.current.language”.
Locale.current returns an Array of Tag(s) now. But the old Locale.current(Ruby-GetText) and Locale.get returns Locale::Object (similier with Locale::Tag::Posix). This is the class for backward compatibility.
It is recommanded to use Locale.current or Locale.candidates to find the current locale instead of this function.
Constant Summary
Constants included from Util::Memoizable
Util::Memoizable::MEMOIZED_IVAR
Instance Method Summary collapse
-
#charset ⇒ Object
Returns the top priority charset.
-
#country ⇒ Object
Returns the top priority region/country.
-
#extensions ⇒ Object
Returns the top priority extensions.(common, rfc, cldr).
-
#language ⇒ Object
Returns the top priority language.
-
#modifier ⇒ Object
Returns the top priority modifier.
-
#privateuse ⇒ Object
Returns the top priority privateuse(rfc).
-
#region ⇒ Object
Returns the top priority region/country.
-
#script ⇒ Object
Returns the top priority script.
- #to_cldr ⇒ Object
- #to_common ⇒ Object
- #to_posix ⇒ Object
- #to_rfc ⇒ Object
- #to_s ⇒ Object
- #to_simple ⇒ Object
- #to_str ⇒ Object
-
#variants ⇒ Object
Returns the top priority variants.(common, rfc, cldr).
Methods included from Util::Memoizable
#_memoize, #_memoize_dup, #clear, #freeze, #freeze_without_memoizable, #memoize, #memoize_clear, #memoize_dup, #memoize_impl
Instance Method Details
#charset ⇒ Object
Returns the top priority charset. (posix)
48 49 50 51 52 53 54 |
# File 'lib/locale/taglist.rb', line 48 def charset if self[0].respond_to? :charset self[0].charset else ::Locale.driver_module.charset end end |
#country ⇒ Object
Returns the top priority region/country. (simple)
36 37 38 |
# File 'lib/locale/taglist.rb', line 36 def country self[0].region end |
#extensions ⇒ Object
Returns the top priority extensions.(common, rfc, cldr)
70 71 72 |
# File 'lib/locale/taglist.rb', line 70 def extensions (self[0].respond_to? :extensions) ? self[0].extensions : nil end |
#language ⇒ Object
Returns the top priority language. (simple)
32 33 34 |
# File 'lib/locale/taglist.rb', line 32 def language self[0].language end |
#modifier ⇒ Object
Returns the top priority modifier. (posix)
58 59 60 |
# File 'lib/locale/taglist.rb', line 58 def modifier (self[0].respond_to? :modifier) ? self[0].modifier : nil end |
#privateuse ⇒ Object
Returns the top priority privateuse(rfc)
76 77 78 |
# File 'lib/locale/taglist.rb', line 76 def privateuse (self[0].respond_to? :privateuse) ? self[0].privateuse : nil end |
#region ⇒ Object
Returns the top priority region/country. (simple)
40 41 42 |
# File 'lib/locale/taglist.rb', line 40 def region self[0].region end |
#script ⇒ Object
Returns the top priority script. (common)
44 45 46 |
# File 'lib/locale/taglist.rb', line 44 def script self[0].script end |
#to_cldr ⇒ Object
101 102 103 |
# File 'lib/locale/taglist.rb', line 101 def to_cldr self[0].to_cldr end |
#to_common ⇒ Object
89 90 91 |
# File 'lib/locale/taglist.rb', line 89 def to_common self[0].to_common end |
#to_posix ⇒ Object
105 106 107 |
# File 'lib/locale/taglist.rb', line 105 def to_posix self[0].to_posix end |
#to_rfc ⇒ Object
97 98 99 |
# File 'lib/locale/taglist.rb', line 97 def to_rfc self[0].to_rfc end |
#to_s ⇒ Object
85 86 87 |
# File 'lib/locale/taglist.rb', line 85 def to_s self[0].to_s end |
#to_simple ⇒ Object
93 94 95 |
# File 'lib/locale/taglist.rb', line 93 def to_simple self[0].to_simple end |
#to_str ⇒ Object
81 82 83 |
# File 'lib/locale/taglist.rb', line 81 def to_str self[0].to_str end |
#variants ⇒ Object
Returns the top priority variants.(common, rfc, cldr)
64 65 66 |
# File 'lib/locale/taglist.rb', line 64 def variants (self[0].respond_to? :variants) ? self[0].variants : nil end |