em-dir-watcher 명령 줄의 example.rb 파일과 같이 성공적으로 사용했지만 다른 클래스의 메서드를 호출해야하므로 스크립트/러너를 선택했습니다. 대신 레일을 호출하십시오.스크립트/러너 내에서 EventMachine 실행
나는 복사/예제 코드를 붙여과 self.methodName의 내부에 위치이 오류가 발생했습니다
MyApp를/공급 업체/레일/railties/lib 디렉토리/명령/runner.rb : 48 : 정의되지 않은 메서드`시계 'EventMachine에 대한 : 모듈 (NoMethodError)
내가 좋아하는 완전히 간단한 것을 실행하더라도 :
def self.watcher
EM.run {
dw = EMDirWatcher.watch '.' do |paths|
paths.each do |path|
puts path
end
end
puts "Monitoring"
}
end
및 스크립트/러너 호출 :
script/runner "require 'rubygems'; require 'em-dir-watcher'; Myclass.watcher"
을
그래도 오류가 발생합니다. 내가 도대체 뭘 잘못하고있는 겁니까?