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
7 posts
• Page 1 of 1
ruby variables in own class
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:
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...
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:
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...
- stw
- Posts: 111
- Joined: Tue Jul 13, 2010 11:09 am
Re: ruby variables in own class
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
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.
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
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" (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
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" (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.
-
chackl - Posts: 233
- Joined: Tue Aug 17, 2010 8:46 pm
- Location: Austria / Salzburg
Re: ruby variables in own class
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
Maybe you could post a short example?
I know that i do not have the best solution - but maybe we could find a better
I know that i do not have the best solution - but maybe we could find a better
100% accuracy is the guarantee to your success. The value alters if you combine it with musical creativity.
-
chackl - Posts: 233
- Joined: Tue Aug 17, 2010 8:46 pm
- Location: Austria / Salzburg
7 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 79 guests