2012-04-29 74 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

相關問題