Module: SearchCopGrammar::Nodes::Base

Included in:
Binary, Collection, FulltextExpression, MatchesFulltext, Not
Defined in:
lib/search_cop_grammar/nodes.rb

Instance Method Summary collapse

Instance Method Details

#and(node) ⇒ Object



6
7
8
# File 'lib/search_cop_grammar/nodes.rb', line 6

def and(node)
  And.new self, node
end

#can_flatten?Boolean

Returns:

  • (Boolean)


18
19
20
# File 'lib/search_cop_grammar/nodes.rb', line 18

def can_flatten?
  false
end

#can_group?Boolean

Returns:

  • (Boolean)


26
27
28
# File 'lib/search_cop_grammar/nodes.rb', line 26

def can_group?
  false
end

#can_optimize?Boolean

Returns:

  • (Boolean)


38
39
40
# File 'lib/search_cop_grammar/nodes.rb', line 38

def can_optimize?
  can_flatten? || can_group?
end

#finalize!Object



48
49
50
# File 'lib/search_cop_grammar/nodes.rb', line 48

def finalize!
  self
end

#flatten!Object



22
23
24
# File 'lib/search_cop_grammar/nodes.rb', line 22

def flatten!
  self
end

#fulltext?Boolean

Returns:

  • (Boolean)


34
35
36
# File 'lib/search_cop_grammar/nodes.rb', line 34

def fulltext?
  false
end

#group!Object



30
31
32
# File 'lib/search_cop_grammar/nodes.rb', line 30

def group!
  self
end

#nodesObject



52
53
54
# File 'lib/search_cop_grammar/nodes.rb', line 52

def nodes
  []
end

#notObject



14
15
16
# File 'lib/search_cop_grammar/nodes.rb', line 14

def not
  Not.new self
end

#optimize!Object



42
43
44
45
46
# File 'lib/search_cop_grammar/nodes.rb', line 42

def optimize!
  flatten!.group! while can_optimize?

  finalize!
end

#or(node) ⇒ Object



10
11
12
# File 'lib/search_cop_grammar/nodes.rb', line 10

def or(node)
  Or.new self, node
end