Experiments with ruby-processing (processing-2.2.1) and JRubyArt for processing-3.0

Thursday 28 May 2009

Interactive editing using watch

A couple of really neat features you should experiment with when using ruby-processing. One is the interactive editing mode 'rp5 watch my_program.rb' where you can update the code whilst the program is running. Another is the feature $app.find_method("ellipse"), well any other method besides "ellipse" if you will. Heres the code of a little app I was running with the above query, and all the ellipse methods were listed (including the camel-case variants such as ellipseMode ...).


class AppTest < Processing::App
        def setup
                size 100, 100
                puts $app.find_method("vertex")
        end
end


I edited my code to the above substituting "vertex" for ellipse, and on saving the vertex methods (and their camel-case variants) were listed. Pretty cool eh!!

Note that you should avoid camel-case as I get the feeling it is there for backward compatibility, and ruby methods should be preferred over processing where both APIs could be used...

PS: find_method search must be of regex variety, if you try "tan" for example you get 'curveTangent' as well as 'instance_of?' methods listed.

No comments:

Post a Comment

Followers

About Me

My photo
I have developed JRubyArt and propane new versions of ruby-processing for JRuby-9.1.5.0 and processing-3.2.2