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, AnywhereExpression, Column, ComparativeExpression, ComplexExpression, DoubleQuotedValue, NotExpression, OrExpression, ParenthesesExpression, SingleQuotedValue, Value
Instance Attribute Summary collapse
Instance Method Summary
collapse
Instance Attribute Details
#query_info ⇒ Object
Returns the value of attribute query_info.
7
8
9
|
# File 'lib/search_cop_grammar.rb', line 7
def query_info
@query_info
end
|
Instance Method Details
#collection_for(key) ⇒ Object
21
22
23
24
25
|
# File 'lib/search_cop_grammar.rb', line 21
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
17
18
19
|
# File 'lib/search_cop_grammar.rb', line 17
def elements
super.select { |element| element.class != Treetop::Runtime::SyntaxNode }
end
|
#evaluate ⇒ Object
13
14
15
|
# File 'lib/search_cop_grammar.rb', line 13
def evaluate
elements.collect(&:evaluate).inject(:and)
end
|