Page 1 of 1
Ruby: extending via libraries-folder?
Posted: Sun Sep 07, 2014 8:52 pm
by tulamide
Ok, this one is for the ruby pros among us. I stumbled upon the libraries folder in the Ruby installation of Flowstone (...\Flowstone\ruby\libraries). Inside are folders that contain ruby files in a certain structure (a script and a folder both of the same name, subfolders containg scripts the main script depends on, etc.). This reminds me of RubyGems. Unfortunately the 'gem' keyword isn't recognized. Now my question:
Let's say I have some code that calculates a list of points, using 4 variables as input and the list as output. Making a module out of it (with class definiton, method definition, etc.) and saving it as a .rb file, would I be able to extend Flowstone's ruby by just adding my module to the libraries folder?
If not, is there another way to extend ruby?
Has anyone already played with it? Trog? Nubeat7? Myco? Anyone?

Re: Ruby: extending via libraries-folder?
Posted: Sun Sep 07, 2014 11:59 pm
by billv
tulamide wrote:Unfortunately the 'gem' keyword isn't recognized
User Guide...p227
If you have a Gem you want to use with FlowStone then if it is implemented in pure Ruby you should
have no problem using it. You will need to place the ruby files for the gem in a folder and then
reference that folder when you write your
'require' statement. You could also put it in the FlowStone
install folder under “ruby/libraries”
tulamide wrote:Let's say I have some code that calculates a list of points, using 4 variables as input and the list as output. Making a module out of it (with class definiton, method definition, etc.) and saving it as a .rb file, would I be able to extend Flowstone's ruby by just adding my module to the libraries folder?
If not, is there another way to extend ruby?
What about External dll with The Win32 API Extension..User Guide...p 212..??
Re: Ruby: extending via libraries-folder?
Posted: Mon Sep 08, 2014 12:38 am
by tulamide
billv wrote:tulamide wrote:Unfortunately the 'gem' keyword isn't recognized
User Guide...p227
If you have a Gem you want to use with FlowStone then if it is implemented in pure Ruby you should
have no problem using it. You will need to place the ruby files for the gem in a folder and then
reference that folder when you write your
'require' statement. You could also put it in the FlowStone
install folder under “ruby/libraries”
Ah, thanks for pointing me to it. I remember that I've read it, but at that time I had no clue what a rubygem is. So it isn't possible to do a standard gem install (using "gem install --local path_to_gem/filename.gem"), but a manual installation will work. Thanks.
billv wrote:tulamide wrote:Let's say I have some code that calculates a list of points, using 4 variables as input and the list as output. Making a module out of it (with class definiton, method definition, etc.) and saving it as a .rb file, would I be able to extend Flowstone's ruby by just adding my module to the libraries folder?
If not, is there another way to extend ruby?
What about External dll with The Win32 API Extension..User Guide...p 212..??
Why are you asking this? I want to create ruby code that I would like to have ready for access inside the rubyedit. In other words, I want to extend ruby with my own modules. Could you explain further how that would work with dll files?
Re: Ruby: extending via libraries-folder?
Posted: Mon Sep 08, 2014 1:14 am
by billv
tulamide wrote:Why are you asking this? I want to create ruby code that I would like to have ready for access inside the rubyedit. In other words, I want to extend ruby with my own modules
I thought that was what it was for, create your own functions and stuff, and then call it
within your code.
No idea how to use it though, bit hard for me, but looks like a very powerfull
way of extending ruby.
Re: Ruby: extending via libraries-folder?
Posted: Mon Sep 08, 2014 1:24 am
by tulamide
billv wrote:tulamide wrote:Why are you asking this? I want to create ruby code that I would like to have ready for access inside the rubyedit. In other words, I want to extend ruby with my own modules
I thought that was what it was for, create your own functions and stuff, and then call it
within your code.
No idea how to use it though, bit hard for me, but looks like a very powerfull
way of extending ruby.
I see what you mean! But that would require me to program in C++, to create the dll, which I can't
Basically a dll is a bunch of C/C++ methods/functions, that will be executed when you call them using predefined accessors. Using the ruby library folder and access ruby made modules seems to be the easier way for me
