call 2

call(*args)
Instance Public methods

def #eval_proc(*args)

# The scope of the eval-block of 'eval_proc' method is different from
# the external. If you want to pass local values to the eval-block,
# use arguments of eval_proc method. They are passed to block-arguments.
if block_given?
  cmd = Proc.new
else
  unless (cmd = args.shift)
    fail ArgumentError, "A Proc or Method object is expected for 1st argument"
  end
end
if TclTkLib.mainloop_thread? == true
  # call from eventloop
  current = Thread.current
  backup_ip = current[:callback_ip]
  current[:callback_ip] = self
  begin
    eval_proc_core(false,
                   proc{|safe, *params|
                     $SAFE=safe if $SAFE < safe
                     cmd.call(*params)
                   }, *args)
  ensure
    current[:callback_ip] = backup_ip
  end
else
  eval_proc_core(true,
                 proc{|safe, *params|
                   $SAFE=safe if $SAFE < safe
                   Thread.new(*params, &cmd).value
                 },
                 *args)
end

end

doc_ruby_on_rails
2015-04-13 01:16:55
Comments
Leave a Comment

Please login to continue.