The basic idea behind this gem is to be able to detect if a non nested hash matches a query string. The query syntax is extremely simple but has some limitations.
Example
query = '(name=john&age>20)|(name!=john&age<40)'
input = { 'name' => 'john', 'age' => 30 }
PoshyMatcher.match?(query, input) # true
Poshy Matcher is just a minimal interface to a Treetop based Parser. Check the grammar for more details.
To run the tests:
$ rake
This is just a proof of concept of something needed for a personal project, so I just spent a few hours working on this.
Right now is not possible to compare floating point numbers.
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request