If you have a problem or need to report a bug please email : support@dsprobotics.com
There are 3 sections to this support area:
DOWNLOADS: access to product manuals, support files and drivers
HELP & INFORMATION: tutorials and example files for learning or finding pre-made modules for your projects
USER FORUMS: meet with other users and exchange ideas, you can also get help and assistance here
NEW REGISTRATIONS - please contact us if you wish to register on the forum
Users are reminded of the forum rules they sign up to which prohibits any activity that violates any laws including posting material covered by copyright
Editing RubyEdit class
24 posts
• Page 3 of 3 • 1, 2, 3
Re: Editing RubyEdit class
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?
-
Nubeat7 - Posts: 1347
- Joined: Sat Apr 14, 2012 9:59 am
- Location: Vienna
Re: Editing RubyEdit class
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.
- Exo
- Posts: 426
- Joined: Wed Aug 04, 2010 8:58 pm
- Location: UK
Re: Editing RubyEdit class
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!
Don't stagnate, mutate to create!
-
trogluddite - Posts: 1730
- Joined: Fri Oct 22, 2010 12:46 am
- Location: Yorkshire, UK
Re: Editing RubyEdit class
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
- RJHollins
- Posts: 1571
- Joined: Thu Mar 08, 2012 7:58 pm
24 posts
• Page 3 of 3 • 1, 2, 3
Who is online
Users browsing this forum: No registered users and 65 guests