Exception: UnitMeasurements::UnitAlreadyDefinedError
- Inherits:
-
BaseError
- Object
- StandardError
- BaseError
- UnitMeasurements::UnitAlreadyDefinedError
- Defined in:
- lib/unit_measurements/errors/unit_already_defined_error.rb
Overview
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.
Instance Attribute Summary collapse
-
#unit ⇒ String
readonly
The name of the unit that is already defined.
Instance Method Summary collapse
-
#initialize(unit) ⇒ UnitAlreadyDefinedError
constructor
Initializes a new
UnitAlreadyDefinedError
instance.
Constructor Details
#initialize(unit) ⇒ UnitAlreadyDefinedError
Initializes a new UnitAlreadyDefinedError
instance.
31 32 33 34 35 |
# File 'lib/unit_measurements/errors/unit_already_defined_error.rb', line 31 def initialize(unit) @unit = unit super("Unit already defined: '#{unit}'.") end |
Instance Attribute Details
#unit ⇒ String (readonly)
The name of the unit that is already defined.
23 24 25 |
# File 'lib/unit_measurements/errors/unit_already_defined_error.rb', line 23 def unit @unit end |