Support

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

Ruby: extending via libraries-folder?

For general discussion related FlowStone

Ruby: extending via libraries-folder?

Postby tulamide » Sun Sep 07, 2014 8:52 pm

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?

:)
"There lies the dog buried" (German saying translated literally)
tulamide
 
Posts: 2714
Joined: Sat Jun 21, 2014 2:48 pm
Location: Germany

Re: Ruby: extending via libraries-folder?

Postby billv » Sun Sep 07, 2014 11:59 pm

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..??
billv
 
Posts: 1157
Joined: Tue Aug 31, 2010 3:34 pm
Location: Australia

Re: Ruby: extending via libraries-folder?

Postby tulamide » Mon Sep 08, 2014 12:38 am

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?
"There lies the dog buried" (German saying translated literally)
tulamide
 
Posts: 2714
Joined: Sat Jun 21, 2014 2:48 pm
Location: Germany

Re: Ruby: extending via libraries-folder?

Postby billv » Mon Sep 08, 2014 1:14 am

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.
billv
 
Posts: 1157
Joined: Tue Aug 31, 2010 3:34 pm
Location: Australia

Re: Ruby: extending via libraries-folder?

Postby tulamide » Mon Sep 08, 2014 1:24 am

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 :oops:
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 :D
"There lies the dog buried" (German saying translated literally)
tulamide
 
Posts: 2714
Joined: Sat Jun 21, 2014 2:48 pm
Location: Germany


Return to General

Who is online

Users browsing this forum: No registered users and 72 guests