How do I get access to what's in $stderr in the form of a string?

In particular, I am using the following code

require 'shell'
Shell.def_system_command("dialog")
shell = Shell.new
shell.transact do
shell.dialog("--title", "test", "--menu", "test", "0", "0", "9", "test 
tag", "test item")
end

dialog directs output, in this case, "test tag" to STDERR after the 
user presses enter.

I would like to capture the value "test tag" as string assigned to a 
variable.

Does anyone know a way to do this? Hopefully a simple way.

I'm aware of a way to do something similar provided by Brain Candler in 
an earlier message:

http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/71151

I am having trouble following how I might implement the above, and I 
don't know if it is the answer to the difficulty I am having.

Thank you in advance for any help.

Regards,

Mark Wilson