Method: JSE::Stream#filter!

Defined in:
lib/jse/stream.rb

#filter!(field, text, ignore_case = false) ⇒ Object



22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/jse/stream.rb', line 22

def filter!(field, text, ignore_case = false)
  if looks_like_regexp?(text)
    if ignore_case
      filters << RegexpFilter.new(field, text, Regexp::IGNORECASE)
    else
      filters << RegexpFilter.new(field, text)
    end
  else
    if ignore_case
      filters << CaseInsensitiveFilter.new(field, text)
    else
      filters << Filter.new(field, text)
    end
  end
end