Sha256: 94242f20a8859cfcd89abfbb173aa7f0b0ee20403b8230c2569b48f47d47f9f2

Contents?: true

Size: 894 Bytes

Versions: 1

Compression:

Stored size: 894 Bytes

Contents

# frozen_string_literal: true

module BasicTemperature
  class Temperature
    module Assertions
      private

      def assert_either_positional_arguments_or_keyword_arguments!(positional_arguments, keyword_arguments)
        raise_initialization_arguments_error if positional_arguments.any? && keyword_arguments.any?
        raise_initialization_arguments_error if positional_arguments.none? && keyword_arguments.none?
      end

      def assert_valid_degrees!(degrees)
        raise_invalid_degrees_error unless degrees.is_a?(Numeric)
      end

      def assert_valid_scale!(scale)
        raise_invalid_scale_error unless SCALES.include?(scale)
      end

      def assert_numeric!(numeric)
        raise_invalid_numeric(numeric) unless numeric.is_a?(Numeric)
      end

      def assert_temperature(temperature)
        temperature.instance_of?(Temperature)
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
basic_temperature-1.0.0 lib/basic_temperature/temperature/assertions.rb