Class: WAB::Impl::Regex
- Defined in:
- lib/wab/impl/exprs/regex.rb
Instance Method Summary collapse
- #eval(data) ⇒ Object
-
#initialize(path, rx) ⇒ Regex
constructor
Creates a new instance with the provided parameters.
- #native ⇒ Object
Constructor Details
#initialize(path, rx) ⇒ Regex
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
11 12 13 14 |
# 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 |
Instance Method Details
#eval(data) ⇒ Object
16 17 18 19 20 |
# 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 ⇒ Object
22 23 24 |
# File 'lib/wab/impl/exprs/regex.rb', line 22 def native() ['REGEX', path, @rx.source] end |