class Locale::Tag::Simple
-
ja-392
* ja-JP
* ja_JP (country: RFC4646 (ISO3166/UN M.49) (2 alpha or 3 digit)
* ja (language: ISO 639 (2 or 3 alpha))
all of language tag specifications have.
This class has <language>, <region> which
Abstract language tag class.
def <=>(other)
def <=>(other) self.to_s <=> other.to_s end
def ==(other) #:nodoc:
def ==(other) #:nodoc: other != nil and hash == other.hash end
def candidates
Returns an Array of tag-candidates order by priority.
def candidates [self.class.new(language, region), self.class.new(language)] end
def convert_to(klass) #:nodoc:
def convert_to(klass) #:nodoc: if klass == Simple || klass == Posix klass.new(language, region) else klass.new(language, nil, region) end end
def country; region end
def country; region end
def eql?(other) #:nodoc:
def eql?(other) #:nodoc: self.==(other) end
def hash #:nodoc:
def hash #:nodoc: "#{self.class}:#{to_s}".hash end
def initialize(language, region = nil)
def initialize(language, region = nil) raise "language can't be nil." unless language @language, @region = language, region @language = @language.downcase if @language @region = @region.upcase if @region end
def inspect #:nodoc:
def inspect #:nodoc: %Q[#<#{self.class}: #{to_s}>] end
def language=(val)
def language=(val) @language = val @language = @language.downcase if @language @language end
def parse(tag)
def parse(tag) case tag when TAG_RE ret = self.new($1, $2) ret.tag = tag ret else nil end end
def region=(val)
def region=(val) @region = val @region = @region.upcase if @region @region end
def to_s
Returns the language tag as the String.
def to_s to_string end
def to_str #:nodoc:
def to_str #:nodoc: to_s end
def to_string
Return simple language tag which format is"
def to_string s = @language.dup s << "_" << @region if @region s end