Exception: UnitMeasurements::ParseError
- 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.
Instance Attribute Summary collapse
-
#string ⇒ String
readonly
The input string that caused the error while parsing.
Instance Method Summary collapse
-
#initialize(string) ⇒ ParseError
constructor
Initializes a new
ParseErrorinstance.
Constructor Details
#initialize(string) ⇒ ParseError
Initializes a new ParseError instance.
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
#string ⇒ String (readonly)
The input string that caused the error while parsing.
23 24 25 |
# File 'lib/unit_measurements/errors/parse_error.rb', line 23 def string @string end |