module Regexp::Scanner
def self.validation_error(type, what, reason)
Centralizes and unifies the handling of validation related
def self.validation_error(type, what, reason) case type when :group error = InvalidGroupError.new(what, reason) when :backref error = InvalidBackrefError.new(what, reason) when :sequence error = InvalidSequenceError.new(what, reason) else error = ValidationError.new('expression') end raise error # unless @@config.validation_ignore end