more regexp caching

This commit is contained in:
Alexey Verkhovsky 2005-01-21 22:40:16 +00:00
parent 780bf4fe91
commit 661fb64561

View file

@ -38,8 +38,12 @@ module WikiChunk
# method will return the WikiWord instead of the usual +nil+. # method will return the WikiWord instead of the usual +nil+.
# The +page_name+ method returns the matched WikiWord. # The +page_name+ method returns the matched WikiWord.
class Word < WikiLink class Word < WikiLink
unless defined? WIKI_LINK
WIKI_WORD = Regexp.new('(\\\\)?(' + WikiWords::WIKI_WORD_PATTERN + ')\b', 0, "utf-8")
end
def self.pattern def self.pattern
Regexp.new('(\\\\)?(' + WikiWords::WIKI_WORD_PATTERN + ')\b', 0, "utf-8") WIKI_WORD
end end
attr_reader :page_name attr_reader :page_name