Sha256: 0c9ac32156c688a8deb3e2c40efa6d40b4142d080b1e2623c403acc3feae6959

Contents?: true

Size: 1.03 KB

Versions: 4

Compression:

Stored size: 1.03 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.
    #
    # @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

4 entries across 4 versions & 1 rubygems

Version Path
unit_measurements-5.0.0 lib/unit_measurements/errors/unit_already_defined_error.rb
unit_measurements-4.12.0 lib/unit_measurements/errors/unit_already_defined_error.rb
unit_measurements-4.11.0 lib/unit_measurements/errors/unit_already_defined_error.rb
unit_measurements-4.10.0 lib/unit_measurements/errors/unit_already_defined_error.rb