Class: SearchCopGrammar::BaseNode
- Inherits:
-
Treetop::Runtime::SyntaxNode
- Object
- Treetop::Runtime::SyntaxNode
- SearchCopGrammar::BaseNode
show all
- Defined in:
- lib/search_cop_grammar.rb
Direct Known Subclasses
AndExpression, AndOrExpression, AnywhereExpression, Column, ComparativeExpression, ComplexExpression, DoubleQuotedValue, NotExpression, OrExpression, ParenthesesExpression, SingleQuotedValue, Value
Instance Attribute Summary collapse
Instance Method Summary
collapse
Instance Attribute Details
#query_info ⇒ Object
8
9
10
|
# File 'lib/search_cop_grammar.rb', line 8
def query_info
(@query_info ||= nil) || parent.query_info
end
|
#query_options ⇒ Object
12
13
14
|
# File 'lib/search_cop_grammar.rb', line 12
def query_options
(@query_options ||= nil) || parent.query_options
end
|
Instance Method Details
#collection_for(key) ⇒ Object
24
25
26
27
28
|
# File 'lib/search_cop_grammar.rb', line 24
def collection_for(key)
raise(SearchCop::UnknownColumn, "Unknown column #{key}") if query_info.scope.reflection.attributes[key].nil?
Attributes::Collection.new query_info, key
end
|
#elements ⇒ Object
20
21
22
|
# File 'lib/search_cop_grammar.rb', line 20
def elements
super.reject { |element| element.instance_of?(Treetop::Runtime::SyntaxNode) }
end
|
#evaluate ⇒ Object
16
17
18
|
# File 'lib/search_cop_grammar.rb', line 16
def evaluate
elements.collect(&:evaluate).inject(:and)
end
|