Class: InclusiveOrExpression

Inherits:
OrExpression show all
Defined in:
lib/glark/match/ior.rb

Overview

Evaluates the expressions, and is satisfied when any one returns true.

Instance Attribute Summary

Attributes inherited from CompoundExpression

#ops

Attributes inherited from Expression

#matches

Instance Method Summary collapse

Methods inherited from OrExpression

#end_position, #evaluate, #explain, #inspect

Methods inherited from CompoundExpression

#==, #initialize, #reset_file, #start_position

Methods inherited from Expression

#add_match, #end_position, #initialize, #process, #reset_file, #start_position, #to_s

Constructor Details

This class inherits a constructor from CompoundExpression

Instance Method Details

#criteriaObject



17
18
19
# File 'lib/glark/match/ior.rb', line 17

def criteria
  ops.size == 2 ? "either" : "any of"
end

#is_match?(matched_ops) ⇒ Boolean

Returns:

  • (Boolean)


9
10
11
# File 'lib/glark/match/ior.rb', line 9

def is_match? matched_ops
  return matched_ops.size > 0
end

#operatorObject



13
14
15
# File 'lib/glark/match/ior.rb', line 13

def operator
  "or"
end