Created
June 6, 2019 22:07
-
-
Save jacobo/e8595bdcdea1075bee2fbd4a2a5f151a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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