Class: Fluent::FilterWhere::Parser::NullOpExp

Inherits:
Exp
  • Object
show all
Defined in:
lib/fluent/plugin/filter_where/parser/exp.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(literal, operator) ⇒ NullOpExp

Returns a new instance of NullOpExp.

Parameters:

  • literal (ParserLiteral)
  • operator (Symbol)


117
118
119
120
# File 'lib/fluent/plugin/filter_where/parser/exp.rb', line 117

def initialize(literal, operator)
  @literal = literal
  @operator = operator
end

Instance Attribute Details

#literalObject (readonly)

Returns the value of attribute literal.



113
114
115
# File 'lib/fluent/plugin/filter_where/parser/exp.rb', line 113

def literal
  @literal
end

#operatorObject (readonly)

Returns the value of attribute operator.



113
114
115
# File 'lib/fluent/plugin/filter_where/parser/exp.rb', line 113

def operator
  @operator
end

Instance Method Details

#eval(record) ⇒ Boolean

Returns:

  • (Boolean)


123
124
125
126
127
128
129
130
131
132
133
134
# File 'lib/fluent/plugin/filter_where/parser/exp.rb', line 123

def eval(record)
  is_null = literal.get(record).nil?
  case operator
  when :EQ
    is_null
  when :NEQ
    ! is_null
  else
    assert(false)
    false
  end
end