Class: Locale::Tag::Simple

Class | Locale::Tag::Simple
In: | lib/locale/tag/simple.rb
Parent: | Object

Abstract language tag class. This class has <language>, <region> which all of language tag specifications have.

- ja (language: ISO 639 (2 or 3 alpha))
- ja_JP (country: RFC4646 (ISO3166/UN M.49) (2 alpha or 3 digit)
- ja-JP
- ja-392

### Methods

<=> candidates country language= new parse region= to_s

### Included Modules

Util::Memoizable Util::Memoizable Util::Memoizable

### Constants

ALPHA | = | '[a-z]'
DIGIT | = | '[0-9]'
ALPHANUM | = | "[a-zA-Z0-9]"
LANGUAGE | = | "(#{ALPHA}{2,3})"
REGION | = | "(#{ALPHA}{2}|#{DIGIT}{3})"
TAG_RE | = | /\A#{LANGUAGE}(?:[_-]#{REGION})?\Z/i

### Attributes

language | [R] |
region | [R] |
tag | [RW] | tag is set when .parse method is called. This value is used when the program want to know the original String.

### Public Class methods

new(language, region = nil)

Create a Locale::Tag::Simple

parse(tag)

Parse the language tag and return the new Locale::Tag::Simple.

### Public Instance methods

<=>(other)
candidates()

Returns an Array of tag-candidates order by priority. Use Locale.candidates instead of this method.

country()

For backward compatibility.

language=(val)

Set the language (with downcase)

region=(val)

Set the region (with upcase)

to_s()

Returns the language tag as the String.

      <language>_<REGION>
      (e.g.) "ja_JP"

[Validate]