Class: LanguageTool::Resources::Language
- Inherits:
-
Object
- Object
- LanguageTool::Resources::Language
- Includes:
- Comparable
- Defined in:
- lib/languagetool/resources/language.rb
Instance Attribute Summary collapse
-
#code ⇒ Object
readonly
Returns the value of attribute code.
-
#long_code ⇒ Object
readonly
Returns the value of attribute long_code.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
- #<=>(other) ⇒ Object
-
#initialize(json) ⇒ Language
constructor
A new instance of Language.
- #to_s ⇒ Object
Constructor Details
#initialize(json) ⇒ Language
Returns a new instance of Language.
8 9 10 11 12 |
# File 'lib/languagetool/resources/language.rb', line 8 def initialize(json) @name = json['name'] @code = json['code'] @long_code = json['longCode'] || json['code'] end |
Instance Attribute Details
#code ⇒ Object (readonly)
Returns the value of attribute code.
6 7 8 |
# File 'lib/languagetool/resources/language.rb', line 6 def code @code end |
#long_code ⇒ Object (readonly)
Returns the value of attribute long_code.
6 7 8 |
# File 'lib/languagetool/resources/language.rb', line 6 def long_code @long_code end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
6 7 8 |
# File 'lib/languagetool/resources/language.rb', line 6 def name @name end |
Instance Method Details
#<=>(other) ⇒ Object
18 19 20 |
# File 'lib/languagetool/resources/language.rb', line 18 def <=>(other) long_code <=> other.long_code end |
#to_s ⇒ Object
14 15 16 |
# File 'lib/languagetool/resources/language.rb', line 14 def to_s "#{name} (#{long_code})" end |