Page 1 of 1
Ruby Programming Language
Posted: Fri Oct 19, 2012 12:52 am
by Eugene529
Is it possible to add libraries to the Ruby programming extension?
Re: Ruby Programming Language
Posted: Fri Oct 19, 2012 7:31 am
by trogluddite
Hi Eugene,
Firstly, let me say that I'm quite new to Ruby myself, so I won't guarnatee that what I say is true in ALL circumstances.
But, yes, as far as I can see FS Ruby fully supports the Ruby "require" method that allows the import of external libraries either as Ruby scripts (.rb) or compiled code (.so files). You just have to be sure that Ruby can find them - either by placing them in the "libraries" folder of the FS installation, or by adding the filepath to Ruby's standard search paths using the command...
$: << "filepath"
If you export as .exe, you will also need to make sure that you copy your library files to the directory where the .exe lives when using them on another machine - they are not automatically embedded into the export.
Alternatively, you can embed Ruby libraries inside the schematic by making use of Ruby's shared namespace. If you put a module inside your schematic that contains a Ruby full of class and module definitions, you can access them from any other Ruby primitive inside the schematic - without even having to join them together or anything!
It also supports the "Win32API" module - so you can also have Rubies that access external .dll libraries - though again, you will have to be careful that the .dll's are available on any machines that you export .exe's to.