SHARE
TWEET

Untitled

a guest Jun 18th, 2019 56 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. def json_pretty(obj)
  2.   str = StringIO.new
  3.   Pry::ColorPrinter.pp(JSON.parse(obj.to_json), str, (`tput cols` || "200").strip.to_i)
  4.   str.rewind
  5.   puts str.read.gsub("=>", ": ")
  6. end
  7.  
  8. def pretty(obj)
  9.   str = StringIO.new
  10.   Pry::ColorPrinter.pp(JSON.parse(obj.to_json), str, (`tput cols` || "200").strip.to_i)
  11.   str.rewind
  12.   puts str.read
  13. end
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top