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.
8 9 10 11 12 13 14 |
# File 'lib/deepl/resources/language.rb', line 8 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.
6 7 8 |
# File 'lib/deepl/resources/language.rb', line 6 def code @code end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
6 7 8 |
# File 'lib/deepl/resources/language.rb', line 6 def name @name end |
Instance Method Details
#supports_formality? ⇒ Boolean
20 21 22 23 24 |
# File 'lib/deepl/resources/language.rb', line 20 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
16 17 18 |
# File 'lib/deepl/resources/language.rb', line 16 def to_s "#{code} - #{name}" end |