Pipe Variable to BBEdit

Hi folks.

Just trying to find a way to pipe a current variable to BBEdit.
Essentially I would like some output to go directly to BBEdit. This is
what I got so far:

res = Net::HTTP.post_form(uri, params)
cmd = %w{ res.body | bbedit}

result = IO.popen(cmd, ‘r+’) {|io|
io.puts pagestring
io.close_write
io.read
}

Any advice appreciated.

Cheers

response = #{res.body} | bbedit should work.

Sorry, I misunderstood. Try:
IO.popen(‘bedit’, ‘r+’) do |io|
io.puts(res.body)
io.close_write
puts io.gets
end

This is what ended up with:

def open_in_BBEdit(this_var)
this_var = this_var.inspect
this_var.gsub(/(/, “\(”).gsub(/)/, “\)”)
system “echo ‘#{this_var}’ | bbedit”
end

The escaping was keeping the item from showing up in BBEdit.

Cheers