Evaluate Ruby snippets and capture stdout, stderr, and return values.
gem install dorian-evalAlso included in the aggregate gem:
gem install dorianeval [options] "ruby code"Run eval -h for generated option details and eval -v for the installed version.
- The library exposes
Dorian::Eval.eval. The executable prints the returned result object.
eval "1 + 1" --returnsrequire "dorian/eval"
result = Dorian::Eval.eval(ruby: "1 + 1", fast: true)
result.returned # => 2