RUBY Persistence question

For general discussion related FlowStone
Post Reply
RJHollins
Posts: 1573
Joined: Thu Mar 08, 2012 7:58 pm

RUBY Persistence question

Post by RJHollins »

Reading the manual it states:
Persistence
The Ruby component saves its state. If you save a schematic with a Ruby component in it then when
you load it back the @ins and @outs arrays are restored to exactly how they were before. This
ensures that the component maintains its state at all times.


It then goes on to mention 'User State Management'
User State Management
If you have your own data that you want to save with a Ruby component then you can implement the
saveState and loadState methods:
def loadState v
end
def saveState
end
The way this works is really simple. In the saveState method you return a Ruby object that
encapsulates all the data that you want to save. It could be a string or an array say if you have lots of
data or it could just be a simple value.


This is an intriguing concept that I've just read, and makes me think of some use possibilities.

My question ... COULD this concept be utilized to provide a basis to implement a 'Trial Period' for a demo ???
With maybe some 'Total' number of runs ... or a Date the application is first launched, with a way to have an incremented counter that would trigger after so many weeks [for example].

Just reading this and thinking out loud. Is this a possibility? Has anyone tried something like this ?

Please ... no politics or moral judgments !!! I'm looking at concepts.

Thanks.
Tzarls
Posts: 54
Joined: Thu Oct 21, 2010 2:10 am

Re: RUBY Persistence question

Post by Tzarls »

The problem here is that all content is saved WHEN THE SCHEMATIC IS SAVED (at least I think that´s the way it works). So for your idea to work in a plugin you should be able to save the "schematic" behind the plugin, and AFAIK that´s not possible. For a working protection system the developer is forced to use some external reference, be it a (probably hidden or encrypted) file or an entry in the windows´registry.
Post Reply