Ruby IRB 彩蛋

brookepowell · 2021年02月05日 · 最后由 aaline57963 回复于 2021年02月18日 · 674 次阅读

需要 ruby 大于等于 2.7

irb
IRB.send :easter_egg, :dancing

2.7.2 刚试了下只输入 IRB.send :easter_egg 返回随机结果,可能是静态的也可能是动态的

SuMingXuan 回复

嗯,共有两种,如果不填 type,就随机。

IRB.send :easter_egg, :logo
IRB.send :easter_egg, :dancing

2.7.0p0 返回了 NoMethodError (undefined method 'easter_egg' for IRB:Module) 😂

需要 登录 后方可回复, 如果你还没有账号请 注册新账号