From 2fe633b7492890808b0ff7f3e57c5de2dd98ccee Mon Sep 17 00:00:00 2001 From: nagai Date: Thu, 2 Sep 2004 17:17:20 +0000 Subject: * ext/tcltklib/tcltklib.c: fix typo [ruby-talk:111266] * ext/tk/lib/tk/text.rb: fix typo * ext/tk/lib/multi-tk.rb: improve safe-level treatment on slave IPs git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@6852 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ext/tk/sample/tkoptdb-safeTk.rb | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) (limited to 'ext/tk/sample') diff --git a/ext/tk/sample/tkoptdb-safeTk.rb b/ext/tk/sample/tkoptdb-safeTk.rb index a5e394b23..ebbc7b486 100644 --- a/ext/tk/sample/tkoptdb-safeTk.rb +++ b/ext/tk/sample/tkoptdb-safeTk.rb @@ -26,10 +26,29 @@ else File.dirname(__FILE__))) end file = File.expand_path('tkoptdb.rb', File.dirname(__FILE__)) -MultiTkIp.new_safeTk{ - ent.each{|pat, val| TkOptionDB.add(pat, val)} + +ip = MultiTkIp.new_safeTk{ + # When a block is given to 'new_safeTk' method, + # the block is evaluated on $SAFE==4. + ent.each{|pat, val| Tk.tk_call('option', 'add', pat, val)} +} + +=begin +ip.eval_proc{ + # When a block is given to 'eval_proc' method, + # the block is evaluated on the IP's current safe level. + # So, the followings raises exceptions. load file } +=end + +ip.eval_proc(proc{ + # When a Procedure object is given to 'eval_proc' method as an argument, + # the proc is evaluated on the proc's binding. + # So, the followings are evaluated on $SAFE==0 + load file +}) + # Tk.mainloop is ignored on the slave-IP Tk.mainloop -- cgit