ruby执行字符串代码

str = "a='abcd'; a.reverse"

字符串str为ruby代码,执行方法eval

eval str
=> "dcba"
原文地址:https://www.cnblogs.com/wangyuyu/p/6924999.html