Module: StructuredSearch

Defined in:
lib/structured_search.rb,
lib/structured_search/lexer.rb,
lib/structured_search/token.rb,
lib/structured_search/errors.rb,
lib/structured_search/parser.rb,
lib/structured_search/version.rb,
lib/structured_search/patterns.rb,
lib/structured_search/base_node.rb,
lib/structured_search/evaluator.rb,
lib/structured_search/tree/from.rb,
lib/structured_search/tree/where.rb,
lib/structured_search/tree/select.rb,
lib/structured_search/tree/string.rb,
lib/structured_search/tree/asterisk.rb

Defined Under Namespace

Modules: Tree Classes: Evaluator, Lexer, LexicalError, Parser, ProviderNotAvailableError, SyntaxError, Token, UnregisteredProviderError

Constant Summary collapse

VERSION =

:nodoc:

"0.0.1"

Class Method Summary collapse

Class Method Details

.evaluate(input, providers) ⇒ Object

Creates an evaluator instance, with a given input and provider hash and returns the evaluator result. Params:

input

Input string to parse and evaluate.

providers

The search provider keys and classes.



17
18
19
20
21
22
# File 'lib/structured_search.rb', line 17

def evaluate(input, providers)
  parser = StructuredSearch::Parser.new(input, providers)
  parser.parse_to_end
  @evaluator = StructuredSearch::Evaluator.new(parser.statements)
  @evaluator.eval if @evaluator
end