我按照本教程创建了一个简单的命令行 gem,现在我想用raad扩展功能。目前,我按照教程进行了以下更改:
垃圾箱/zerp:
#!/usr/bin/env ruby
require 'zerp'
class Zerp
def start
Raad::Logger.debug 'zerp started'
EventMachine.run do
EventMachine.add_periodic_timer(1) do
Raad::Logger.info 'zerp is running'
end
end
end
def stop
EventMachine.stop
Raad::Logger.debug 'zerp stopped'
end
end
库/zerp.rb:
require 'zerp/version'
require 'eventmachine'
require 'raad'
module Zerp
end
当我从命令行运行客户端时,出现以下错误。
user@zenbook:~/git/zerp :) zerp
/home/user/.local/lib/ry/rubies/1.9.3-p194/lib/ruby/gems/1.9.1/gems/zerp-0.0.1/bin/zerp:5:in `<top (required)>': Zerp is not a class (TypeError)
from /home/user/.local/lib/ry/current/bin/zerp:23:in `load'
from /home/user/.local/lib/ry/current/bin/zerp:23:in `<main>'
user@zenbook:~/git/zerp :(
什么是让这个工作的正确方法?