Sha256: f07da04002b59d475b5c7136113363f59d05540fb764d32b02ed5a17a229be91

Contents?: true

Size: 583 Bytes

Versions: 5

Compression:

Stored size: 583 Bytes

Contents

# frozen_string_literal: true

module DeepL
  module Resources
    class Language < Base
      attr_reader :code, :name

      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

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
deepl-rb-2.5.3 lib/deepl/resources/language.rb
deepl-rb-2.5.2 lib/deepl/resources/language.rb
deepl-rb-2.5.1 lib/deepl/resources/language.rb
deepl-rb-2.5.0 lib/deepl/resources/language.rb
deepl-rb-2.4.0 lib/deepl/resources/language.rb