Class: MatchOperator

Inherits:
Object
  • Object
show all
Includes:
BinaryOperator
Defined in:
lib/json_expr/operators/match_operator.rb

Instance Method Summary collapse

Methods included from BinaryOperator

#evaluate

Instance Method Details

#binary(evaluator, lhs, rhs) ⇒ Object



8
9
10
11
12
13
14
15
16
# File 'lib/json_expr/operators/match_operator.rb', line 8

def binary(evaluator, lhs, rhs)
  text = evaluator.string_convert(lhs)
  unless text.nil?
    pattern = evaluator.string_convert(rhs)
    unless pattern.nil?
      text.match(pattern)
    end
  end
end