class Regexp::Scanner::ValidationError

Base for all scanner validation errors

Public Class Methods

for(type, problem, reason = nil) click to toggle source

Centralizes and unifies the handling of validation related errors.

# File lib/regexp_parser/scanner/errors/validation_error.rb, line 5
def self.for(type, problem, reason = nil)
  types.fetch(type).new(problem, reason)
end
types() click to toggle source
# File lib/regexp_parser/scanner/errors/validation_error.rb, line 9
def self.types
  @types ||= {
    backref:      InvalidBackrefError,
    group:        InvalidGroupError,
    group_option: InvalidGroupOption,
    posix_class:  UnknownPosixClassError,
    property:     UnknownUnicodePropertyError,
    sequence:     InvalidSequenceError,
  }
end