In case you need to give users the ability to submit / persist formulas (e.g. tax calculations etc..) in a safe way, I recommend you have a look at Keisan.
Keisan is a purely interpreted expression evaluator in Ruby. It is quite powerful and can be extended with custom functions.
If you're interested, we wrote a blog article about it introducing its core features:
https://www.keypup.io/blog/safe-expression-evaluation-in-ruby-for-user-submitted-formulas