lib/deepl/resources/language.rb in deepl-rb-2.3.1 vs lib/deepl/resources/language.rb in deepl-rb-2.4.0

- old
+ new

@@ -3,18 +3,25 @@ module DeepL module Resources class Language < Base attr_reader :code, :name - def initialize(code, name, *args) + def initialize(code, name, supports_formality, *args) super(*args) @code = code @name = name + @supports_formality = supports_formality end def to_s "#{code} - #{name}" + end + + def supports_formality? + return @supports_formality unless @supports_formality.nil? + + raise Exceptions::NotSupported, 'Support formality is only available on target languages' end end end end