class Webgen::Language

Describes a human language which is uniquely identfied by a three letter code and, optionally, by an alternative three letter or a two letter code.

Attributes

codes[R]

An array containing the language codes for the language.

description[R]

The english description of the language.

Public Class Methods

new(codes, description) click to toggle source

Create a new language. codes has to be an array containing three strings: the three letter code, the alternative three letter code and the two letter code. If one is not available for the language, it has to be nil.

   # File lib/webgen/languages.rb
19 def initialize(codes, description)
20   @codes = codes
21   @description = description
22 end

Public Instance Methods

code2chars() click to toggle source

The two letter code.

   # File lib/webgen/languages.rb
25 def code2chars
26   @codes[2]
27 end
code3chars() click to toggle source

The three letter code.

   # File lib/webgen/languages.rb
30 def code3chars
31   @codes[0]
32 end
code3chars_alternative() click to toggle source

The alternative three letter code.

   # File lib/webgen/languages.rb
35 def code3chars_alternative
36   @codes[1]
37 end
to_s() click to toggle source

The textual representation of the language.

   # File lib/webgen/languages.rb
40 def to_s
41   code2chars || code3chars
42 end
Also aliased as: to_str
to_str()
Alias for: to_s