class Rabbit::Searcher
Public Class Methods
new(canvas)
click to toggle source
# File lib/rabbit/searcher.rb, line 5 def initialize(canvas) @canvas = canvas end
Public Instance Methods
regexp(text)
click to toggle 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
internal_regexp()
click to toggle source
# File lib/rabbit/searcher.rb, line 18 def internal_regexp begin /#{@text}/iu rescue RegexpError /#{Regexp.escape(@text)}/iu end end