Class: Lingo24::Language

Inherits:
Object
  • Object
show all
Defined in:
lib/lingo24/language.rb

Overview

Model class for the Languageā€™s returned from the Lingo24 Translation APIs.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(code, name) ⇒ Language

Creates a new Language.

Parameters: code - a string containing the ISO-639-1 code for the language. name - a string containing the friendly name for the language.



12
13
14
15
# File 'lib/lingo24/language.rb', line 12

def initialize(code, name)
  @code = code
  @name = name
end

Instance Attribute Details

#codeObject (readonly)

Returns the value of attribute code.



5
6
7
# File 'lib/lingo24/language.rb', line 5

def code
  @code
end

#nameObject (readonly)

Returns the value of attribute name.



5
6
7
# File 'lib/lingo24/language.rb', line 5

def name
  @name
end

Instance Method Details

#to_sObject

Overrides default to_s to return a friendly display of the object.



18
19
20
# File 'lib/lingo24/language.rb', line 18

def to_s
  "(" + code + ": " + name + ")"
end