Neewby question: how to monitor a variable value

L

Luc Juggery

Hello All,

I remember reading in a book that we could very easily monitor the
value of a variable and have for instance an alert message displayed
each time this variable s modified. I do not manage to find how to do
this anymore.
Would you have any clues ?

Thanks a lot,
Luc
 
P

Phrogz

Luc said:
I remember reading in a book that we could very easily monitor the
value of a variable and have for instance an alert message displayed
each time this variable s modified. I do not manage to find how to do
this anymore.

While I'm sure many other similar libraries exist, I'd like to offer up
my own EventTarget library. Instead of being tied to a single event
like the Observable pattern, you can register different callbacks for
different types of actions that occur.

http://phrogz.net/RubyLibs/rdoc/files/EventTarget_rb.html

One of these days I'll get around to learning how to gem up my libs.
Until then, you can download the source code from the link on that page.
 
J

Joel VanderWerf

Luc said:
Hello All,

I remember reading in a book that we could very easily monitor the
value of a variable and have for instance an alert message displayed
each time this variable s modified. I do not manage to find how to do
this anymore.
Would you have any clues ?

See also http://raa.ruby-lang.org/project/observable. (And see the
example in my post a few minutes ago on the thread "[ANN] Dependency
1.0.0".)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,215
Messages
2,571,113
Members
47,713
Latest member
LeliaB1379

Latest Threads

Top