Class: SearchCop::Visitors::Postgres::FulltextQuery
- Inherits:
-
Visitor
- Object
- Visitor
- SearchCop::Visitors::Postgres::FulltextQuery
show all
- Defined in:
- lib/search_cop/visitors/postgres.rb
Instance Attribute Summary
Attributes inherited from Visitor
#connection
Instance Method Summary
collapse
Methods inherited from Visitor
#initialize, #quote, #quote_column_name, #quote_table_name, #visit, #visit_SearchCopGrammar_Nodes_And, #visit_SearchCopGrammar_Nodes_Equality, #visit_SearchCopGrammar_Nodes_Generator, #visit_SearchCopGrammar_Nodes_GreaterThan, #visit_SearchCopGrammar_Nodes_GreaterThanOrEqual, #visit_SearchCopGrammar_Nodes_LessThan, #visit_SearchCopGrammar_Nodes_LessThanOrEqual, #visit_SearchCopGrammar_Nodes_Matches, #visit_SearchCopGrammar_Nodes_Not, #visit_SearchCopGrammar_Nodes_NotEqual, #visit_SearchCopGrammar_Nodes_Or, #visit_attribute
Instance Method Details
#visit_SearchCopGrammar_Nodes_And_Fulltext(node) ⇒ Object
31
32
33
|
# File 'lib/search_cop/visitors/postgres.rb', line 31
def visit_SearchCopGrammar_Nodes_And_Fulltext(node)
node.nodes.collect { |child_node| "(#{visit child_node})" }.join(" & ")
end
|
#visit_SearchCopGrammar_Nodes_MatchesFulltext(node) ⇒ Object
27
28
29
|
# File 'lib/search_cop/visitors/postgres.rb', line 27
def visit_SearchCopGrammar_Nodes_MatchesFulltext(node)
"'#{node.right.gsub(/[\s&|!:'"]+/, " ")}'"
end
|
#visit_SearchCopGrammar_Nodes_MatchesFulltextNot(node) ⇒ Object
23
24
25
|
# File 'lib/search_cop/visitors/postgres.rb', line 23
def visit_SearchCopGrammar_Nodes_MatchesFulltextNot(node)
"!'#{node.right.gsub(/[\s&|!:'"]+/, " ")}'"
end
|
#visit_SearchCopGrammar_Nodes_Or_Fulltext(node) ⇒ Object
35
36
37
|
# File 'lib/search_cop/visitors/postgres.rb', line 35
def visit_SearchCopGrammar_Nodes_Or_Fulltext(node)
node.nodes.collect { |child_node| "(#{visit child_node})" }.join(" | ")
end
|