Sha256: 4874f7f13e942de1d6ee4ef712fc0481e7936f55dd4b2c83789b6cafd1e88012

Contents?: true

Size: 714 Bytes

Versions: 4

Compression:

Stored size: 714 Bytes

Contents

# Copyright 2021 Daniel Herzog
# Use of this source code is governed by an MIT
# license that can be found in the LICENSE.md file.
# 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

4 entries across 4 versions & 1 rubygems

Version Path
deepl-rb-3.1.0 lib/deepl/resources/language.rb
deepl-rb-3.0.2 lib/deepl/resources/language.rb
deepl-rb-3.0.1 lib/deepl/resources/language.rb
deepl-rb-3.0.0 lib/deepl/resources/language.rb