class Locale::Info::Language

This class contains all the of the ISO information for the ISO 639-3 languages. This class is immutable once constructed.

Attributes

name[R]
scope[R]
three_code[R]
two_code[R]
type[R]

Public Class Methods

new(two_code, three_code, scope, type, name) click to toggle source

Constructs a new Language instance.

  • code The 2 or 3 digit ISO 639-3 language code.

  • scope A single character that defines the ISO scope of the language - (I)ndividual, (M)acrolanguage, or (S)pecial.

  • type A single character that defines the ISO type of the language - (A)ncient, (C)onstructed, (E)xtinct, (H)istorical, (L)iving, or (S)pecial.

  • name The name of the language.

# File lib/locale/info/language.rb, line 33
def initialize(two_code, three_code, scope, type, name)
  @two_code, @three_code, @scope, @type, @name = two_code, three_code, scope, type, name

  @individual   = (scope == "I")
  @macro        = (scope == "M")
  @special      = (scope == "S")
  @constructed  = (type == "C")
  @living       = (type == "L")
  @extinct      = (type == "E")
  @ancient      = (type == "A")
  @historical   = (type == "H")
  @special_type = (type == "S")
end

Public Instance Methods

ancient?() click to toggle source

Returns true if the language is an ancient language according to the ISO 639-3 data.

# File lib/locale/info/language.rb, line 66
def ancient?; @ancient; end
constructed?() click to toggle source

Returns true if the language is a constructed language according to the ISO 639-3 data.

# File lib/locale/info/language.rb, line 57
def constructed?; @constructed; end
extinct?() click to toggle source

Returns true if the language is an extinct language according to the ISO 639-3 data.

# File lib/locale/info/language.rb, line 63
def extinct?; @extinct; end
historical?() click to toggle source

Returns true if the language is an historical language according to the ISO 639-3 data.

# File lib/locale/info/language.rb, line 69
def historical?; @historical; end
individual?() click to toggle source

Returns true if the language is an individual language according to the ISO 639-3 data.

# File lib/locale/info/language.rb, line 48
def individual?; @individual; end
iso_language?() click to toggle source

Returns this object is valid as ISO 639 data.

# File lib/locale/info/language.rb, line 84
def iso_language?
  @@lang_two_codes[two_code] != nil || @@lang_three_codes[three_code] != nil
end
living?() click to toggle source

Returns true if the language is a living language according to the ISO 639-3 data.

# File lib/locale/info/language.rb, line 60
def living?; @living; end
macro?() click to toggle source

Returns true if the language is a macro language according to the ISO 639-3 data.

# File lib/locale/info/language.rb, line 51
def macro?; @macro; end
special?() click to toggle source

Returns true if the language is a special language according to the ISO 639-3 data.

# File lib/locale/info/language.rb, line 54
def special?; @special; end
special_type?() click to toggle source

Returns true if the language is a special type language according to the ISO 639-3 data.

# File lib/locale/info/language.rb, line 72
def special_type?; @special_type; end
to_s() click to toggle source

Returns the two or three code.

# File lib/locale/info/language.rb, line 75
def to_s
  if two_code and two_code.size > 0
    two_code
  else
    three_code
  end
end