2012-04-29 37 views
1

我尝试运行红宝石处理文件红宝石处理:未定义的方法错误

[email protected]:~/Twitter-Emotion-Graphs/samples/contributed$ rp5 run sand_traveler.rb 
undefined method `current' for Processing::App:Class 
    ./sand_traveler.rb:63:in `initialize' 
    ./sand_traveler.rb:43:in `reset_all' 
    org/jruby/RubyFixnum.java:256:in `times' 
    ./sand_traveler.rb:40:in `reset_all' 
    ./sand_traveler.rb:22:in `setup' 
    /var/lib/gems/1.8/gems/ruby-processing-1.0.11/lib/ruby-processing/app.rb:211:in `handleDraw' 

语境和代码sand_traveler.rb:http://ashkenas.com/codework/ruby-processing.html

我敢肯定所有必要的模块已安装(java,ruby,ruby-processing) 我能够使用rp5运行其他其他ruby处理.rb文件。只有这一个显示错误。

PS:文件位置是否重要?该文件位于我的主文件夹中。

回答

0

尝试更换的sand_traveler.rb线63:

@app = Processing::App.current 

有:

@app = $app 

我得到了同样的错误,你和这个固定为我。 ($app是运行草图的全局句柄,这也是Processing::App.current应该执行的操作 - 请参阅v0.3的CHANGELOG条目)。

至于为什么它不起作用 - 似乎这种方法已从最新版本的ruby-processing中删除。如果你看一下version 0.8例如Processing::App定义上的ruby-proccessing.rb线40类方法:

def self.current; @current_app; end 

这种方法在最新版本中失踪。

+0

太棒了。有效。 – user1324579 2012-04-29 14:00:04

相关问题