Flowdock
method

initialize_regexp

Importance_0
initialize_regexp(pattern) private

No documentation

This method has no description. You can help the Ruby community by adding new notes.

Hide source
# File lib/uri/common.rb, line 396
    def initialize_regexp(pattern)
      ret = {}

      # for URI::split
      ret[:ABS_URI] = Regexp.new('\A\s*' + pattern[:X_ABS_URI] + '\s*\z', Regexp::EXTENDED)
      ret[:REL_URI] = Regexp.new('\A\s*' + pattern[:X_REL_URI] + '\s*\z', Regexp::EXTENDED)

      # for URI::extract
      ret[:URI_REF]     = Regexp.new(pattern[:URI_REF])
      ret[:ABS_URI_REF] = Regexp.new(pattern[:X_ABS_URI], Regexp::EXTENDED)
      ret[:REL_URI_REF] = Regexp.new(pattern[:X_REL_URI], Regexp::EXTENDED)

      # for URI::escape/unescape
      ret[:ESCAPED] = Regexp.new(pattern[:ESCAPED])
      ret[:UNSAFE]  = Regexp.new("[^#{pattern[:UNRESERVED]}#{pattern[:RESERVED]}]")

      # for Generic#initialize
      ret[:SCHEME]   = Regexp.new("^#{pattern[:SCHEME]}$")
      ret[:USERINFO] = Regexp.new("^#{pattern[:USERINFO]}$")
      ret[:HOST]     = Regexp.new("^#{pattern[:HOST]}$")
      ret[:PORT]     = Regexp.new("^#{pattern[:PORT]}$")
      ret[:OPAQUE]   = Regexp.new("^#{pattern[:OPAQUE_PART]}$")
      ret[:REGISTRY] = Regexp.new("^#{pattern[:REG_NAME]}$")
      ret[:ABS_PATH] = Regexp.new("^#{pattern[:ABS_PATH]}$")
      ret[:REL_PATH] = Regexp.new("^#{pattern[:REL_PATH]}$")
      ret[:QUERY]    = Regexp.new("^#{pattern[:QUERY]}$")
      ret[:FRAGMENT] = Regexp.new("^#{pattern[:FRAGMENT]}$")

      ret
    end
Register or log in to add new notes.