Class: Gaigo::Langs::Lang

Inherits:
Object
  • Object
show all
Defined in:
lib/gaigo/langs.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#codeObject (readonly)

Returns the value of attribute code.



8
9
10
# File 'lib/gaigo/langs.rb', line 8

def code
  @code
end

#enObject (readonly)

Returns the value of attribute en.



8
9
10
# File 'lib/gaigo/langs.rb', line 8

def en
  @en
end

#nativeObject (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_methodObject



18
19
20
# File 'lib/gaigo/langs.rb', line 18

def to_method
  en.downcase.gsub(/\W|\d/,"_")
end

#to_sObject



15
16
17
# File 'lib/gaigo/langs.rb', line 15

def to_s
  "#{en} (#{native})"
end