NoMethodError: rubyfiddle.com 中未定义的方法"require"



http://rubyfiddle.com/对它的使用有一些限制,它甚至不允许我使用gem。我的小提琴中的这段代码:

require 'net/http'

引发错误

NoMethodError: undefined method `require' for Object:Class

requireload 是内核模块命名空间中的方法,看起来它们在 RubyFiddle 沙箱中都不可用,例如

puts Kernel.methods

如果你想玩 Net::HTTP,试试 repl 像 irb 或 pry 一样。注意:其他在线交互式红宝石外壳(例如 TryRuby.org(也有类似的限制。

最新更新