Skip to content

Instantly share code, notes, and snippets.

@jacobo
Created June 6, 2019 22:07
Show Gist options
  • Save jacobo/e8595bdcdea1075bee2fbd4a2a5f151a to your computer and use it in GitHub Desktop.
Save jacobo/e8595bdcdea1075bee2fbd4a2a5f151a to your computer and use it in GitHub Desktop.
def json_pretty(obj)
str = StringIO.new
Pry::ColorPrinter.pp(JSON.parse(obj.to_json), str, (`tput cols` || "200").strip.to_i)
str.rewind
puts str.read.gsub("=>", ": ")
end
def pretty(obj)
str = StringIO.new
Pry::ColorPrinter.pp(JSON.parse(obj.to_json), str, (`tput cols` || "200").strip.to_i)
str.rewind
puts str.read
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment