# SetBuilder

[![Build Status](https://travis-ci.org/boblail/set_builder.png?branch=master)](https://travis-ci.org/boblail/set_builder)
[![Code Climate](https://codeclimate.com/github/boblail/set_builder.png)](https://codeclimate.com/github/boblail/set_builder)

SetBuilder is a library for:

 * Describing a set of constraints in a simple data structure that can easily be serialized
 * Presenting that data structure in natural language
 * Performing the set of constraints as a SQL query



### Example

The following Set describes a group of people:

     [{ trait: :awesome, choices: ["are"] },
      { trait: :attended, choices: ["have"], school: "school" },
      { trait: :died, choices: ["have not"] },
      { trait: :name, modifiers: [{ operator: :is, values: ["Jerome"] }] }]

SetBuilder can render this Set in plain English:

    [Those] who are awesome, who have attended school, who have not died, and whose name is Jerome.

It can also generate an `ActiveRecord::Relation` on an ActiveRecord model to fetch the people who fit in this set.


### Running the tests

*Ruby* `bundle exec rake test`

*Javascript* `jspec run --browsers ff`


Copyright (c) 2010, 2015 Bob Lail, released under the MIT license