$SAFE block?

Hi sir Nobu (aka nobu.nokada@softhome.net
[mailto:nobu.nokada@softhome.net]):


module Kernel
def safe(level)
proc {$SAFE = level; yield}.call

(As a nuby,) I didn’t know this was possible. Is this ruby way? I presume
this is super ruby way then :slight_smile:

I’ve modified it to the nuby way, like this (just to see if I’m thinking
it right):

proc 
       do 
            $SAFE = level; 
            yield 
     end
  .call

And it works still! Very consistent. No surprises for ruby but big happy
surprises for us (nubies :wink:

I think I better read again on procs and calls :slight_smile:

end
end
p Thread.current.safe_level # => 0
p safe(4) { Thread.current.safe_level } # => 4
p Thread.current.safe_level # => 0


Nobu Nakada

kind regards -botp

···

You brilliantly wrote on Wednesday, December 18, 2002 6:44 PM: