class WAB::Impl::Regex
Public Class Methods
new(path, rx)
click to toggle source
Creates a new instance with the provided parameters.
- path
-
path to the value to compare
- rx
-
regexp to match against a string value from the path lookup
Calls superclass method
# File lib/wab/impl/exprs/regex.rb, line 11 def initialize(path, rx) super(path) @rx = rx.is_a?(Regexp) ? rx : Regexp.new(rx.to_s) end
Public Instance Methods
eval(data)
click to toggle source
# File lib/wab/impl/exprs/regex.rb, line 16 def eval(data) value = data.get(path) return @rx === value if value.is_a?(String) false end
native()
click to toggle source
# File lib/wab/impl/exprs/regex.rb, line 22 def native() ['REGEX', path, @rx.source] end