Search code examples
rubyawesomeprint

Ruby's awesome_print to STDERR


How to make ap function (with its color) outputting to STDERR?

ap bla # this goes to STDOUT

Solution

  • Use the Kernel#ai method to get the awesome_print String, then pass it to any output stream you want:

    STDERR.puts foo.ai