gpt4 book ai didi

ruby-on-rails - whois 在 irb 中不起作用

转载 作者:太空宇宙 更新时间:2023-11-03 18:25:14 24 4
gpt4 key购买 nike

我使用 $ gem install whois 安装 whois 并遵循 Ruby Whois
但是当我在 irb 中测试它时,它给出了错误:

1.9.3p194 :001 > c = Whois::Client.new
NameError: uninitialized constant Whois
from (irb):1
from /home/darshana/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.2.8/lib/rails/commands/console.rb:47:in `start'
from /home/darshana/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.2.8/lib/rails/commands/console.rb:8:in `start'
from /home/darshana/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.2.8/lib/rails/commands.rb:41:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>

编辑

当我 require 'whois' 时出现另一个错误:

1.9.3p194 :003 > require 'whois'
LoadError: cannot load such file -- whois
from /home/darshana/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.2.8/lib/active_support/dependencies.rb:251:in `require'
from /home/darshana/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.2.8/lib/active_support/dependencies.rb:251:in `block in require'
from /home/darshana/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.2.8/lib/active_support/dependencies.rb:236:in `load_dependency'
from /home/darshana/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.2.8/lib/active_support/dependencies.rb:251:in `require'
from (irb):3
from /home/darshana/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.2.8/lib/rails/commands/console.rb:47:in `start'
from /home/darshana/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.2.8/lib/rails/commands/console.rb:8:in `start'
from /home/darshana/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.2.8/lib/rails/commands.rb:41:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'

谢谢。

最佳答案

尝试安装和加载对我有用的 whois 库。

> gem install whois
> irb
* require 'whois'
* c = Whois::Client.new
>> #<Whois::Client:0x8f0fa34 @timeout=10, @settings={}>

关于ruby-on-rails - whois 在 irb 中不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12260996/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com