Editing RubyEdit class

For general discussion related FlowStone
User avatar
Nubeat7
Posts: 1347
Joined: Sat Apr 14, 2012 9:59 am
Location: Vienna
Contact:

Re: Editing RubyEdit class

Post by Nubeat7 »

great Myco, thanks, thats a much smarter way to do it, never heard of aliasing methodes, if i understand this right it creates a new defined methode which is always called when the original one gets called?
Exo
Posts: 426
Joined: Wed Aug 04, 2010 8:58 pm
Location: UK
Contact:

Re: Editing RubyEdit class

Post by Exo »

MyCo wrote:You can do that a lot easier, without having to modify the system.fsm. See attached file... just copy the blue module at the top into the schematic where you want to use that feature. Or just open that Schematic once and edit another file (all schematics in the same FlowStone instance get modified)


Nice solution MyCo, thanks.
Flowstone Guru. Blog and download site for Flowstone.
Best VST Plugins. Initial Audio.
User avatar
trogluddite
Posts: 1730
Joined: Fri Oct 22, 2010 12:46 am
Location: Yorkshire, UK

Re: Editing RubyEdit class

Post by trogluddite »

Nubeat7 wrote:aliasing methodes, if i understand this right it creates a new defined methode

Haven't seen MyCo's code, but I would guess that you're exactly right.
Aliasing a method just creates an exact copy of the original with a new name. IMHO "alias" isn't a very good name for it - it's not just letting you use a "pet name" for something, it really does make a whole new method by copying the original, even for methods coded in C++ that you can't access the source code for.

That leaves you free to re-define the original method, but still have access to the old code by using its new name. It's a common technique in Ruby for "monkey patching" - where you want to alter what a method does, but need to be careful not to break any of the original behaviour. Aliasing lets you do that relatively safely without having to know exactly how the original code works.
All schematics/modules I post are free for all to use - but a credit is always polite!
Don't stagnate, mutate to create!
RJHollins
Posts: 1573
Joined: Thu Mar 08, 2012 7:58 pm

Re: Editing RubyEdit class

Post by RJHollins »

Aliasing lets you do that relatively safely without having to know exactly how the original code works.


gee ... that pretty much sums up my work in FS :shock:

:lol:
Post Reply