Sha256: 6da8ddc70bbab51068a4e425c9c786806ada2a80b88cd015be93650b11975fd2

Contents?: true

Size: 1.02 KB

Versions: 24

Compression:

Stored size: 1.02 KB

Contents

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

module UnitMeasurements
  # The +UnitMeasurements::UnitError+ class is used to indicate that an invalid
  # unit was encountered. The error message states that the unit is invalid and
  # provides the name of the problematic unit.
  #
  # This error is raised when the unit is not defined within the unit group.
  #
  # @see BaseError
  # @author {Harshal V. Ladhe}[https://shivam091.github.io/]
  # @since 1.0.0
  class UnitError < BaseError
    # The name of the invalid unit.
    #
    # @return [String] The name of the invalid unit.
    #
    # @author {Harshal V. Ladhe}[https://shivam091.github.io/]
    # @since 1.0.0
    attr_reader :unit

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

      super("Invalid unit: '#{unit}'.")
    end
  end
end

Version data entries

24 entries across 24 versions & 2 rubygems

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