Class: Xail::ContainsFilter

Inherits:
AbstractFilter show all
Defined in:
lib/xail/filter.rb

Instance Method Summary collapse

Methods inherited from AbstractFilter

#filterName

Constructor Details

#initialize(*keys) ⇒ ContainsFilter

Returns a new instance of ContainsFilter.



156
157
158
# File 'lib/xail/filter.rb', line 156

def initialize(*keys)
  @keys = keys
end

Instance Method Details

#streamLine(line) ⇒ Object



160
161
162
163
164
165
166
167
168
169
170
# File 'lib/xail/filter.rb', line 160

def streamLine(line)
  @keys.each do |key|
    if key.instance_of? Regexp and line[key]
      return line
    elsif key.instance_of? String and line.downcase.include? key.downcase
      return line
    end
  end

  nil
end