Guest User

Untitled

a guest
Apr 25th, 2018
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.38 KB | None | 0 0
  1. def browse_string(body)
  2. Tempfile.open('browse_string') do |f|
  3. # I recommend starting testing command with
  4. # BROWSER="open -a firefox" on OS X
  5. browser = ENV.fetch('BROWSER') { 'firefox' }
  6. f.write(body)
  7. f.close
  8. puts "Starting browser #{browser} with response..."
  9. unless system(browser + " " + f.path)
  10. warn "Error starting browser #{browser}"
  11. end
  12. end
  13. end
Add Comment
Please, Sign In to add comment