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, line 19 def initialize(codes, description) @codes = codes @description = description end
Public Instance Methods
code2chars()
click to toggle source
The two letter code.
# File lib/webgen/languages.rb, line 25 def code2chars @codes[2] end
code3chars()
click to toggle source
The three letter code.
# File lib/webgen/languages.rb, line 30 def code3chars @codes[0] end
code3chars_alternative()
click to toggle source
The alternative three letter code.
# File lib/webgen/languages.rb, line 35 def code3chars_alternative @codes[1] end
to_s()
click to toggle source
The textual representation of the language.
# File lib/webgen/languages.rb, line 40 def to_s code2chars || code3chars end
Also aliased as: to_str