Class: LocalURIChunk

Inherits:
URIChunk show all
Defined in:
app/models/chunks/uri.rb

Overview

uri with mandatory scheme but less restrictive hostname, like localhost:2500/blah.html

Constant Summary collapse

ANY_HOSTNAME =

hostname can be just a simple word like ‘localhost’

"(?:#{DOMLABEL}\\.)*#{TOPLABEL}\\.?"
LOCAL_URI =

The basic URI expression as a string Scheme and hostname are mandatory

"(?:(#{SCHEME})://)+" +       # Mandatory scheme://     (\1)
"(?:(#{USERINFO})@)?" +       # Optional userinfo@      (\2)
"(#{ANY_HOSTNAME})" +         # Mandatory hostname      (\3)
"(?::(#{PORT}))?" +           # Optional :port          (\4)
"(#{ABS_PATH})?"  +           # Optional absolute path  (\5)
"(?:\\?(#{QUERY}))?" +        # Optional ?query         (\6)
"(?:\\#(#{FRAGMENT}))?" +     # Optional #fragment      (\7)
'(?=\.?(?:\s|\)|\z))'
LOCAL_URI_REGEXP =

ends only with optional dot + space or “)” or end of the string

Regexp.new(SUSPICIOUS_PRECEDING_CHARACTER + LOCAL_URI, Regexp::EXTENDED, 'N')

Constants inherited from URIChunk

URIChunk::COUNTRY, URIChunk::FRAGMENT, URIChunk::GENERIC, URIChunk::INTERNET_HOSTNAME, URIChunk::INTERNET_URI, URIChunk::INTERNET_URI_REGEXP, URIChunk::PORT, URIChunk::QUERY, URIChunk::SUSPICIOUS_PRECEDING_CHARACTER, URIChunk::TLDS, URIChunk::UNRESERVED_NO_ENDING, URIChunk::URIC_NO_ENDING, URIChunk::USERINFO

Instance Attribute Summary

Attributes inherited from URIChunk

#fragment, #host, #link_text, #path, #port, #query, #user

Attributes inherited from Chunk::Abstract

#text, #unmask_mode, #unmask_text

Class Method Summary collapse

Methods inherited from URIChunk

apply_to, #avoid_autolinking?, #initialize, #port_delimiter, #query_delimiter, #scheme, #scheme_delimiter, #treat_trailing_character, #uri, #user_delimiter

Methods inherited from Chunk::Abstract

apply_to, #escaped?, #id, inherited, #initialize, #mask, mask_re, mask_string, #rendered?, #revert, #unmask

Constructor Details

This class inherits a constructor from URIChunk

Class Method Details

.patternObject



178
179
180
# File 'app/models/chunks/uri.rb', line 178

def LocalURIChunk.pattern
  LOCAL_URI_REGEXP
end