Sha256: 3648dc92abe4ad0440b64f8f799a165e77c8e2b0000171659ab0cf579cc5010e

Contents?: true

Size: 1.11 KB

Versions: 22

Compression:

Stored size: 1.11 KB

Contents

# -*- encoding: utf-8 -*-
# -*- frozen_string_literal: true -*-
# -*- warn_indent: true -*-

module UnitMeasurements
  # The +UnitMeasurements::UnitAlreadyDefinedError+ class is used to indicate
  # that an attempt was made to define a unit that has already been defined
  # within a unit group.
  #
  # The error message states that the unit is already defined and provides the
  # name of the conflicting unit.
  #
  # @see BaseError
  # @author {Harshal V. Ladhe}[https://shivam091.github.io/]
  # @since 1.0.0
  class UnitAlreadyDefinedError < BaseError
    # The name of the unit that is already defined.
    #
    # @return [String] The name of the unit that is already defined.
    #
    # @author {Harshal V. Ladhe}[https://shivam091.github.io/]
    # @since 1.0.0
    attr_reader :unit

    # Initializes a new +UnitAlreadyDefinedError+ instance.
    #
    # @param [String] unit The name of the unit that is already defined.
    #
    # @author {Harshal V. Ladhe}[https://shivam091.github.io/]
    # @since 1.0.0
    def initialize(unit)
      @unit = unit

      super("Unit already defined: '#{unit}'.")
    end
  end
end

Version data entries

22 entries across 22 versions & 2 rubygems

Version Path
unit_measurements_us_complete-5.17.0 lib/unit_measurements/errors/unit_already_defined_error.rb
unit_measurements-5.17.0 lib/unit_measurements/errors/unit_already_defined_error.rb
unit_measurements-5.16.0 lib/unit_measurements/errors/unit_already_defined_error.rb
unit_measurements-5.15.0 lib/unit_measurements/errors/unit_already_defined_error.rb
unit_measurements-5.14.0 lib/unit_measurements/errors/unit_already_defined_error.rb
unit_measurements-5.13.0 lib/unit_measurements/errors/unit_already_defined_error.rb
unit_measurements-5.12.0 lib/unit_measurements/errors/unit_already_defined_error.rb
unit_measurements-5.11.1 lib/unit_measurements/errors/unit_already_defined_error.rb
unit_measurements-5.11.0 lib/unit_measurements/errors/unit_already_defined_error.rb
unit_measurements-5.10.0 lib/unit_measurements/errors/unit_already_defined_error.rb
unit_measurements-5.9.0 lib/unit_measurements/errors/unit_already_defined_error.rb
unit_measurements-5.8.0 lib/unit_measurements/errors/unit_already_defined_error.rb
unit_measurements-5.7.0 lib/unit_measurements/errors/unit_already_defined_error.rb
unit_measurements-5.6.1 lib/unit_measurements/errors/unit_already_defined_error.rb
unit_measurements-5.6.0 lib/unit_measurements/errors/unit_already_defined_error.rb
unit_measurements-5.5.0 lib/unit_measurements/errors/unit_already_defined_error.rb
unit_measurements-5.4.1 lib/unit_measurements/errors/unit_already_defined_error.rb
unit_measurements-5.4.0 lib/unit_measurements/errors/unit_already_defined_error.rb
unit_measurements-5.3.0 lib/unit_measurements/errors/unit_already_defined_error.rb
unit_measurements-5.2.0 lib/unit_measurements/errors/unit_already_defined_error.rb