Class: AttrSearchableGrammar::AnywhereExpression
- Inherits:
-
BaseNode
- Object
- Treetop::Runtime::SyntaxNode
- BaseNode
- AttrSearchableGrammar::AnywhereExpression
show all
- Defined in:
- lib/attr_searchable_grammar.rb
Instance Attribute Summary
Attributes inherited from BaseNode
#model
Instance Method Summary
collapse
Methods inherited from BaseNode
#collection_for, #elements
Instance Method Details
#evaluate ⇒ Object
86
87
88
89
90
91
92
|
# File 'lib/attr_searchable_grammar.rb', line 86
def evaluate
queries = model.default_searchable_attributes.keys.collect { |key| collection_for key }.select { |collection| collection.compatible? text_value }.collect { |collection| collection.matches text_value }
raise AttrSearchable::NoSearchableAttributes if queries.empty?
queries.flatten.inject(:or)
end
|