Ruby modules (primitives?)

Post any examples or modules that you want to share here
Post Reply
pall
Posts: 31
Joined: Thu Dec 09, 2010 1:27 pm
Location: Transilvania
Contact:

Ruby modules (primitives?)

Post by pall »

I believe if we can realize different modules with Ruby - like the greens - that can reuse them anywhere, anytime, would be a great advantage for everyone.
However I think that cannot be made even as the green. For that we could categorize them according to their complexity, level one, level two, level three etc. :idea:
What is your opinion?
This is a proposal. I do not know if you understand. Express myself as hell... ;)

I tried with the simplest.
Attachments
Ruby modules 01.fsm
(1.08 KiB) Downloaded 1546 times
User avatar
trogluddite
Posts: 1730
Joined: Fri Oct 22, 2010 12:46 am
Location: Yorkshire, UK

Re: Ruby modules (primitives?)

Post by trogluddite »

Yes, I think that's a great idea.
Especially good for the GUI, because Ruby can do many good graphics and mouse things that can't be done in green. But also many other things like accessing files, text parsing, some kinds of maths etc. are more powerful in Ruby.

Regarding 'levels', I'm not sure how you would decide what level a module is - but I think you have a good point. Until now most of the Ruby stuff posted is "high level" - like a whole knob all in one code. That's not good to customise and adapt if you don't know Ruby, so taking out the small sections to use like primitives sounds very sensible - give the power of Ruby to all, even if they don't know the programming.
All schematics/modules I post are free for all to use - but a credit is always polite!
Don't stagnate, mutate to create!
pall
Posts: 31
Joined: Thu Dec 09, 2010 1:27 pm
Location: Transilvania
Contact:

Re: Ruby modules (primitives?)

Post by pall »

I understand that Ruby treats everything as objects. So a module that treats a single object, would be the level one. Modules presented by me would be the level one in this case. But if it contains a second object (eg mouseEvent) would be second level, and so.
I have said, this is just my ideas, and I do not decide how to be.

trogluddite wrote:- give the power of Ruby to all, even if they don't know the programming.
-This is the idea-
Cheers!
User avatar
Nubeat7
Posts: 1347
Joined: Sat Apr 14, 2012 9:59 am
Location: Vienna
Contact:

Re: Ruby modules (primitives?)

Post by Nubeat7 »

yes a collection of useful small primitive like ruby modules would be great, i already did a few, sadly i ve nearly no time for FS atm and i`m not on my main FS PC, but here`s a snippet i used in one of my last projects - sometimes its useful when u don`t need to take care from dividing through Zero... whit this it is zero instead of INF to prevent errors. not shure how much sense i tmakes, because you also could keep the divisor greater then Zero but in some cases maybe this is better and /or easier..

Code: Select all

def event i,v
z = @x/@y
z = 0 if @y == 0
output 0, z
end
RJHollins
Posts: 1573
Joined: Thu Mar 08, 2012 7:58 pm

Re: Ruby modules (primitives?)

Post by RJHollins »

More and more playing with RUBY ... still not consistent getting all ideas to work.

Sure hope some additional RUBY snippets could be shared !

The RUBY 'primitive' idea is great. Those graphics modules are great building blocks.

Thanks for posting 8-)
Post Reply