Class: Fluent::FilterWhere::Parser::RegexpOpExp

Inherits:
BinaryOpExp show all
Defined in:
lib/fluent/plugin/filter_where/parser/exp.rb

Instance Attribute Summary collapse

Attributes inherited from BinaryOpExp

#left, #operator, #right

Instance Method Summary collapse

Constructor Details

#initialize(left, right, operator) ⇒ RegexpOpExp

Returns a new instance of RegexpOpExp.



101
102
103
104
# File 'lib/fluent/plugin/filter_where/parser/exp.rb', line 101

def initialize(left, right, operator)
  super(left, right, operator)
  @pattern = Regexp.compile(right.val)
end

Instance Attribute Details

#patternObject (readonly)

Returns the value of attribute pattern.



99
100
101
# File 'lib/fluent/plugin/filter_where/parser/exp.rb', line 99

def pattern
  @pattern
end

Instance Method Details

#eval(record) ⇒ Object



106
107
108
109
# File 'lib/fluent/plugin/filter_where/parser/exp.rb', line 106

def eval(record)
  l = left.get(record)
  !!@pattern.match(l)
end