Safe domain specific language implementation

Greeting All,

I am trying to write code that will interpret user submitted scripts in
a secure way. I have a limited set of functions that they should be
able to call to change various states. I also need the usual branching,
loping, and local variable assignment types of things. (see example
code) I hoped to be able to use Rubyâ??s safe mode for this is ways
similar to artima - Creating DSLs with Ruby

I have a few questions in this regard:

1). Are there any websites/articles that deal with how to use $SAFE
(particularly level 4)

2). In light of http://code.whytheluckystiff.net/sandbox/wiki is this a
feature that is still in development? (please also see
$SAFE =4 safe enough? - Ruby - Ruby-Forum)

3). What are some implementation options? What would be required in
terms of programming?

Thanks

J.F. Miller

=====
Example code

#entrusted user script

#call this function when a power shortage is detected
def power_shortfall
pl = get_power_reading
if pl<100
shutdown_expermint
else
reduse_load(1000-pl/10)
end
end