Exception: UnitMeasurements::ParseError

Inherits:
BaseError
  • Object
show all
Defined in:
lib/unit_measurements/errors/parse_error.rb

Overview

The UnitMeasurements::ParseError class is used to represent an error condition where the library encounters difficulty in parsing a given string. This can occur due to invalid or unexpected input formats.

The error message states that the parser encountered an error while parsing and provides the string that caused the parsing error.

See Also:

Author:

Since:

  • 1.0.0

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(string) ⇒ ParseError

Initializes a new ParseError instance.

Parameters:

  • string (String)

    The input string that caused the error while parsing.

Author:

Since:

  • 1.0.0



31
32
33
34
35
# File 'lib/unit_measurements/errors/parse_error.rb', line 31

def initialize(string)
  @string = string

  super("Unable to parse: '#{string}'.")
end

Instance Attribute Details

#stringString (readonly)

The input string that caused the error while parsing.

Returns:

  • (String)

    The input string that caused the error while parsing.

Author:

Since:

  • 1.0.0



23
24
25
# File 'lib/unit_measurements/errors/parse_error.rb', line 23

def string
  @string
end