Class: Gaigo::Langs::Lang
- Inherits:
-
Object
- Object
- Gaigo::Langs::Lang
- Defined in:
- lib/gaigo/langs.rb
Instance Attribute Summary collapse
-
#code ⇒ Object
readonly
Returns the value of attribute code.
-
#en ⇒ Object
readonly
Returns the value of attribute en.
-
#native ⇒ Object
readonly
Returns the value of attribute native.
Instance Method Summary collapse
-
#initialize(en, code, native) ⇒ Lang
constructor
A new instance of Lang.
- #to_method ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(en, code, native) ⇒ Lang
Returns a new instance of Lang.
9 10 11 12 13 14 |
# File 'lib/gaigo/langs.rb', line 9 def initialize(en, code, native) @en = en @code = code @native = native.encode('UTF-8') freeze end |
Instance Attribute Details
#code ⇒ Object (readonly)
Returns the value of attribute code.
8 9 10 |
# File 'lib/gaigo/langs.rb', line 8 def code @code end |
#en ⇒ Object (readonly)
Returns the value of attribute en.
8 9 10 |
# File 'lib/gaigo/langs.rb', line 8 def en @en end |
#native ⇒ Object (readonly)
Returns the value of attribute native.
8 9 10 |
# File 'lib/gaigo/langs.rb', line 8 def native @native end |
Instance Method Details
#to_method ⇒ Object
18 19 20 |
# File 'lib/gaigo/langs.rb', line 18 def to_method en.downcase.gsub(/\W|\d/,"_") end |
#to_s ⇒ Object
15 16 17 |
# File 'lib/gaigo/langs.rb', line 15 def to_s "#{en} (#{native})" end |