# RQL for Ruby

This is a port of Kris Zyp's [RQL (Resource Query Language)](github.com/kriszyp/rql) to Ruby.

## Installation

$ gem install rql

The current parser uses ExecJS to run the RQL javascript parser. While ExecJS is generally good about using the best available javascript runtime, it's recommended that you use either:

To specify *therubyracer* runtime:

require 'rql'
require 'v8'

Rql.runtime = ExecJS::RubyRacerRuntime.new

To specify *therubyrhino* runtime under JRuby

require 'rql'
require 'rhino'

Rql.runtime = ExecJS::RubyRhinoRuntime.new

## Usage

require 'rql'
query = Rql['id=5&name=foo']

data = [
     {"id" => 1, "name" => "foo"},
     {"id" => 5, "name" => "foo"}        

query.on(data) #=> [{"id" => 5, "name" => "foo"}]

## Notes

You should keep the following in mind:

javascript implementation, execution of the queries may not behave in exactly the same way.

dependent on the Evaluator class being used. Rql::Evaluator::Enumerable implements the evaluation behavior for Enumerable types.

change. That said, it's the best example of how Evaluators are currently implemented.