Class: Query::Parser::Operator

Inherits:
Language
  • Object
show all
Defined in:
lib/query/parser/operator.rb

Constant Summary collapse

OPERATORS =
[
  "^",
  "$",
  ">=",
  "=>",
  "<=",
  "=<",
  "<",
  ">",
  "!",
]
MODIFIERS =
[
  ":::",
  "::",
  ":",
  "===",
  "==",
  "=",
  "",
]

Instance Method Summary collapse

Instance Method Details

#rootObject



28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/query/parser/operator.rb', line 28

def root
  OPERATORS.flat_map do |operator|
    MODIFIERS.map do |modifier|
      str("#{operator}#{modifier}") |
        str("#{modifier}#{operator}") |
        str(operator)
    end.reduce(&:|).then { operator }
  end.reduce(&:|) |
    MODIFIERS.compact_blank.map do |modifier|
      str(modifier)
    end.reduce(&:|)
end