Sha256: b6cc2bc5275652e4eb577e28c35c28f9c535eee0d04f4a9d01ed06c0e6543059

Contents?: true

Size: 1.1 KB

Versions: 4

Compression:

Stored size: 1.1 KB

Contents

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

module UnitMeasurements
  # 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 BaseError
  # @author {Harshal V. Ladhe}[https://shivam091.github.io/]
  # @since 1.0.0
  class ParseError < BaseError
    # The input string that caused the error while parsing.
    #
    # @author {Harshal V. Ladhe}[https://shivam091.github.io/]
    # @since 1.0.0
    attr_reader :string

    # Initializes a new +ParseError+ instance.
    #
    # @param [String] string The input string that caused the error while parsing.
    #
    # @author {Harshal V. Ladhe}[https://shivam091.github.io/]
    # @since 1.0.0
    def initialize(string)
      @string = string

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

Version data entries

4 entries across 4 versions & 1 rubygems

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