Class: Pursuit::PredicateParser
- Inherits:
-
Parslet::Parser
- Object
- Parslet::Parser
- Pursuit::PredicateParser
- Defined in:
- lib/pursuit/predicate_parser.rb
Overview
Parser for predicate queries.
Predicate queries take an attribute, an operator (such as the equal sign), and a value to compare with.
For example, to search for records where the ‘first_name` attribute is equal to “John” and the `last_name` attribute contains either “Doe” or “Smith”, you might use:
> “first_name = John & (last_name ~ Doe | last_name ~ Smith)”
Instance Method Summary collapse
-
#stri(string) ⇒ Object
Helpers.
Instance Method Details
#stri(string) ⇒ Object
Helpers
174 175 176 177 178 179 |
# File 'lib/pursuit/predicate_parser.rb', line 174 def stri(string) string .each_char .map { |c| match("[#{c.upcase}#{c.downcase}]") } .reduce(:>>) end |