class Rabbit::Searcher
Public Class Methods
Source
# File lib/rabbit/searcher.rb, line 5 def initialize(canvas) @canvas = canvas end
Public Instance Methods
Source
# File lib/rabbit/searcher.rb, line 9 def regexp(text) unless text == @text @text = text @regexp = nil end @regexp ||= internal_regexp end
Private Instance Methods
Source
# File lib/rabbit/searcher.rb, line 18 def internal_regexp begin /#{@text}/iu rescue RegexpError /#{Regexp.escape(@text)}/iu end end