Class: Lingo24::Language
- Inherits:
-
Object
- Object
- Lingo24::Language
- Defined in:
- lib/lingo24/language.rb
Overview
Model class for the Languageās returned from the Lingo24 Translation APIs.
Instance Attribute Summary collapse
-
#code ⇒ Object
readonly
Returns the value of attribute code.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
-
#initialize(code, name) ⇒ Language
constructor
Creates a new
Language
. -
#to_s ⇒ Object
Overrides default
to_s
to return a friendly display of the object.
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
#code ⇒ Object (readonly)
Returns the value of attribute code.
5 6 7 |
# File 'lib/lingo24/language.rb', line 5 def code @code end |
#name ⇒ Object (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_s ⇒ Object
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 |