rubysolo/dentaku — pull request #20 by arnaudl (2014-07-28 15:48:35+00:00)
Title: Return the unbound variables when evaluating invalid expression

This pull request is a follow-up to issue #16. The UnboundVariableError exception now has a unbound_variables method containing an array with the remaining identifiers:

begin
Dentaku::Calculator.new.evaluate!("foo / bar", { foo: nil })
rescue => e
p e.unbound_variables
end

=> [:foo, :bar]

It also treats nil values as unbound variables (avoiding errors like ``NoMethodError: undefined method `/' for nil:NilClass``), and makes UnboundVariableError inherit from StandardError instead of Exception.

Thank you for your library! :)