Ruby Programming Language

For general discussion related FlowStone
Post Reply
Eugene529
Posts: 4
Joined: Wed Oct 17, 2012 10:15 pm

Ruby Programming Language

Post by Eugene529 »

Is it possible to add libraries to the Ruby programming extension?
User avatar
trogluddite
Posts: 1730
Joined: Fri Oct 22, 2010 12:46 am
Location: Yorkshire, UK

Re: Ruby Programming Language

Post 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.
All schematics/modules I post are free for all to use - but a credit is always polite!
Don't stagnate, mutate to create!
Post Reply