From: Mathieu Bouchard Date: 2002-06-13T00:01:09+09:00 Subject: Re: Ruby for jMax On Wed, 12 Jun 2002, david casal wrote: > On Tue, 11 Jun 2002, Mathieu Bouchard wrote: > > Just a note that I wrote a jMax object using the Ruby language. > > It works. > > This functionality will be included in GridFlow 0.6.0. > Can you say more about this? Does it mean you embedded an Ruby interpreter > within JMax, so one can write objects for jMax in a similar way to > Python/Scheme for PD? this is my emulation of the "for" object: # this is the demo and test for Ruby->jMax bridge # FObject is a flow-object as found in jMax # _0_bang means bang message on inlet 0 # FObject#send_thru sends a message through an outlet class RubyFor < GridFlow::FObject attr_accessor :start, :stop, :step def initialize(start,stop,step) raise ArgumentError, "@start not integer" unless Integer===start raise ArgumentError, "@stop not integer" unless Integer===stop raise ArgumentError, "@step not integer" unless Integer===step @start,@stop,@step = start,stop,step end def _0_bang x = start if step > 0 (send_thru 0, x; x += step) while x < stop elsif step < 0 (send_thru 0, x; x += step) while x > stop end end def _0_int(x) self.start = x _0_bang end alias :_1_int :stop= alias :_2_int :step= # FObject.install(name, inlets, outlets) # no support for metaclasses yet install "rubyfor", 3, 1 end ________________________________________________________________ Mathieu Bouchard http://hostname.2y.net/~matju