module Regexp::Syntax

def self.version_class(version)

def self.version_class(version)
  raise InvalidVersionNameError.new(version) unless
    version =~ VERSION_REGEXP
  version_const_name = version.scan(/\d+/).join
  const_name = "Regexp::Syntax::Ruby::V#{version_const_name}"
  if RUBY_VERSION >= '2.0.0'
    Kernel.const_get(const_name)
  else
    Object.module_eval(const_name, __FILE__, __LINE__)
  end
end