Skip to content

Instantly share code, notes, and snippets.

@livoffgrid
Created March 4, 2014 21:36
Show Gist options
  • Select an option

  • Save livoffgrid/9356313 to your computer and use it in GitHub Desktop.

Select an option

Save livoffgrid/9356313 to your computer and use it in GitHub Desktop.
I have some formatted benchmarks going to stdout and I'd like to colorize them. Trouble is when I send a colorized string though the formatter the white space between columns gets ignored.
# Who wants to shave this yak?
# $ irb
# > require 'colorize
# > puts " %-20s %05d" % ['hello', 12]
# hello 00012
# > puts " %-20s %05d" % ['hello'.blue, 12]
# hello 00012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment