Class: DeepL::Resources::Language
- Defined in:
- lib/deepl/resources/language.rb
Instance Attribute Summary collapse
-
#code ⇒ Object
readonly
Returns the value of attribute code.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Attributes inherited from Base
Instance Method Summary collapse
-
#initialize(code, name, supports_formality, *args) ⇒ Language
constructor
A new instance of Language.
- #supports_formality? ⇒ Boolean
- #to_s ⇒ Object
Constructor Details
#initialize(code, name, supports_formality, *args) ⇒ Language
Returns a new instance of Language.
11 12 13 14 15 16 17 |
# File 'lib/deepl/resources/language.rb', line 11 def initialize(code, name, supports_formality, *args) super(*args) @code = code @name = name @supports_formality = supports_formality end |
Instance Attribute Details
#code ⇒ Object (readonly)
Returns the value of attribute code.
9 10 11 |
# File 'lib/deepl/resources/language.rb', line 9 def code @code end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
9 10 11 |
# File 'lib/deepl/resources/language.rb', line 9 def name @name end |
Instance Method Details
#supports_formality? ⇒ Boolean
23 24 25 26 27 |
# File 'lib/deepl/resources/language.rb', line 23 def supports_formality? return @supports_formality unless @supports_formality.nil? raise Exceptions::NotSupported, 'Support formality is only available on target languages' end |
#to_s ⇒ Object
19 20 21 |
# File 'lib/deepl/resources/language.rb', line 19 def to_s "#{code} - #{name}" end |