A simple library to evaluate boolean expressions.
Ruby
Switch branches/tags
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
lib/boolean
test
README.md
Rakefile
boolean-expression.gemspec

README.md

boolean-expression, a simple boolean expression parser/evaluator

This gem is used in packø, needed to check tag filters in non-relational databases.

Simple example:

require 'boolean/expression'

Boolean::Expression['something || something-else'][:something]  # => true
Boolean::Expression['something && something-else'][:something]  # => false
Boolean::Expression['something && !something-else'][:something] # => true

You can also use more complex expression with parenthesis and NOT operators.