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 variables in own class

For general discussion related FlowStone

ruby variables in own class

Postby stw » Mon Jan 13, 2014 12:41 am

Since i went into the challenge of trying to deal with ruby i run into several problems here and there.
Most have to do with real understanding of all that object relating stuff and doing the right things at the right place concerning this matter.
Anyway...i'd like to do something like that:

capture.jpg
capture.jpg (38.28 KiB) Viewed 11314 times

Whatever i tried so far (and it was a lot) i always get that nil error. AFAIK the prob is that the input doesn't get through to the class method? What do i have to do? I guess it's a simple question but i don't get it... :roll:
stw
 
Posts: 111
Joined: Tue Jul 13, 2010 11:09 am

Re: ruby variables in own class

Postby stw » Mon Jan 13, 2014 10:18 am

Nevermind... i got it. Must have done something wrong before but now it works with class variables. Constant works as well...
stw
 
Posts: 111
Joined: Tue Jul 13, 2010 11:09 am

Re: ruby variables in own class

Postby tester » Mon Jan 13, 2014 1:36 pm

As far I remember, there might be something with copy/paste order and parrent folders (modules) for classes.
Need to take a break? I have something right for you.
Feel free to donate. Thank you for your contribution.
tester
 
Posts: 1786
Joined: Wed Jan 18, 2012 10:52 pm
Location: Poland, internet

Re: ruby variables in own class

Postby chackl » Mon Jan 13, 2014 2:04 pm

This may not be a problem with the paste-Order

Defining a Class in a Rubyedit is OK - But getting data from the rubyEdit with the classdefinition is not OK and not that easy ... OK ...

Some smart guy told me some time ago "in ruby everything is an Object" :D (THX trogluddite) - well and if you think about that and combine this with global variables ($varname) then you have some power to get it working ;)

An example in in the file below

Kind Regards, C.Hackl
Attachments
global class data.fsm
(722 Bytes) Downloaded 772 times
100% accuracy is the guarantee to your success. The value alters if you combine it with musical creativity.
User avatar
chackl
 
Posts: 233
Joined: Tue Aug 17, 2010 8:46 pm
Location: Austria / Salzburg

Re: ruby variables in own class

Postby stw » Mon Jan 13, 2014 3:31 pm

Yes, that's how i did it. Thanks for your help. And as i mentioned it also works with class variables and constants. It doesn't necessarily have to ba a global var.
stw
 
Posts: 111
Joined: Tue Jul 13, 2010 11:09 am

Re: ruby variables in own class

Postby chackl » Mon Jan 13, 2014 3:34 pm

Maybe you could post a short example?

I know that i do not have the best solution :D - but maybe we could find a better :D
100% accuracy is the guarantee to your success. The value alters if you combine it with musical creativity.
User avatar
chackl
 
Posts: 233
Joined: Tue Aug 17, 2010 8:46 pm
Location: Austria / Salzburg

Re: ruby variables in own class

Postby stw » Mon Jan 13, 2014 3:47 pm

like this...

vartest.fsm
(464 Bytes) Downloaded 781 times
stw
 
Posts: 111
Joined: Tue Jul 13, 2010 11:09 am


Return to General

Who is online

Users browsing this forum: No registered users and 62 guests