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

NameRead/write?
name R
scope R
three_code R
two_code R
type R

Public Class Methods


new (two_code, three_code, scope, type, name)

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 34
34:       def initialize(two_code, three_code, scope, type, name)
35:         @two_code, @three_code, @scope, @type, @name = two_code, three_code, scope, type, name
36: 
37:         @individual   = (scope == "I")
38:         @macro        = (scope == "M")
39:         @special      = (scope == "S")
40:         @constructed  = (type == "C")
41:         @living       = (type == "L")
42:         @extinct      = (type == "E")
43:         @ancient      = (type == "A")
44:         @historical   = (type == "H")
45:         @special_type = (type == "S")
46:       end

Public Instance Methods


ancient? ()

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

    # File lib/locale/info/language.rb, line 67
67:       def ancient?; @ancient; end

constructed? ()

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

    # File lib/locale/info/language.rb, line 58
58:       def constructed?; @constructed; end

extinct? ()

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

    # File lib/locale/info/language.rb, line 64
64:       def extinct?; @extinct; end

historical? ()

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

    # File lib/locale/info/language.rb, line 70
70:       def historical?; @historical; end

individual? ()

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

    # File lib/locale/info/language.rb, line 49
49:       def individual?; @individual; end

iso_language? ()

Returns this object is valid as ISO 639 data.

    # File lib/locale/info/language.rb, line 81
81:       def iso_language?
82:         @@lang_two_codes[two_code] != nil || @@lang_three_codes[three_code] != nil
83:       end

living? ()

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

    # File lib/locale/info/language.rb, line 61
61:       def living?; @living; end

macro? ()

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

    # File lib/locale/info/language.rb, line 52
52:       def macro?; @macro; end

special? ()

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

    # File lib/locale/info/language.rb, line 55
55:       def special?; @special; end

special_type? ()

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

    # File lib/locale/info/language.rb, line 73
73:       def special_type?; @special_type; end

to_s ()

Returns the two or three code.

    # File lib/locale/info/language.rb, line 76
76:       def to_s
77:         two_code || tree_code
78:       end