From d3b12631ddff44375606977ccdb36fdfa4927495 Mon Sep 17 00:00:00 2001 From: Alexey Verkhovsky Date: Wed, 19 Jan 2005 10:56:46 +0000 Subject: [PATCH] pre-compile and cache URI regexp --- app/models/chunks/uri.rb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/models/chunks/uri.rb b/app/models/chunks/uri.rb index f5a914c2..9251a2fd 100755 --- a/app/models/chunks/uri.rb +++ b/app/models/chunks/uri.rb @@ -60,8 +60,10 @@ class URIChunk < Chunk::Abstract "(?:\\#(#{FRAGMENT}))?" # Optional #fragment (\7) end - def self.pattern() - Regexp.new(URI_PATTERN, Regexp::EXTENDED, 'N') + URI_PATTERN_REGEXP = Regexp.new(URI_PATTERN, Regexp::EXTENDED, 'N') + + def self.pattern + URI_PATTERN_REGEXP end attr_reader :uri, :scheme, :user, :host, :port, :path, :query, :fragment, :link_text