有没有办法打印Ruby函数源,比如JavaScript的Function#toString / toSource?

时间:2011-02-08 02:30:52

标签: ruby

我可以在JS中打印函数的内容作为字符串:

(function (x) { alert(x + 'y'); }).toString()
> "function (x) { alert(x + 'y'); }"

与Ruby有类似的东西吗?

0 个答案:

没有答案