Class: WAB::Impl::In

Inherits:
PathExpr show all
Defined in:
lib/wab/impl/exprs/in.rb

Overview

Match any node that has a value equal to one of the values provided in the argument list after the path. This can be used with any type.

Instance Method Summary collapse

Constructor Details

#initialize(path, *values) ⇒ In

Creates a new instance with the provided parameters.

path

path to the value to compare

values

values to compare to



13
14
15
16
# File 'lib/wab/impl/exprs/in.rb', line 13

def initialize(path, *values)
  super(path)
  @values = values
end

Instance Method Details

#eval(data) ⇒ Object



18
19
20
# File 'lib/wab/impl/exprs/in.rb', line 18

def eval(data)
  @values.include?(data.get(path))
end

#nativeObject



22
23
24
# File 'lib/wab/impl/exprs/in.rb', line 22

def native()
  ['IN', path].concat(@values)
end