Skip to content

Instantly share code, notes, and snippets.

@bhb
Created December 9, 2009 21:48
Show Gist options
  • Save bhb/252859 to your computer and use it in GitHub Desktop.
Save bhb/252859 to your computer and use it in GitHub Desktop.
def browse_string(body)
Tempfile.open('browse_string') do |f|
# I recommend starting testing command with
# BROWSER="open -a firefox" on OS X
browser = ENV.fetch('BROWSER') { 'firefox' }
f.write(body)
f.close
puts "Starting browser #{browser} with response..."
unless system(browser + " " + f.path)
warn "Error starting browser #{browser}"
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment