Basically, you just need to check your inputs and make sure they would create valid ruby code. If so, you can use a string eval. If not, you should use a block eval.