1. Mar 16th, 2007

    warn_with_color

    I can’t guarantee this will work on legacy operating systems, but if you’re using Linux or OS/X, adding a splash of color to your console output helps in finding those ever elusive warnings:

    require "highline"
    require "facet/module/alias_method_chain"
    
    module Kernel
      def warn_with_color(message)
        warn_without_color HighLine.new.color(message.to_s, :red)
      end
      alias_method_chain :warn, :color
    end
    1. Mar 22nd, 2007

      Antoine

      Where do I install it :) ?

    2. Mar 22nd, 2007

      Antoine

      Allright, so either on .irbc (the configuration file for your command-line ruby) or directly in your Ruby Program, right ?

    3. Mar 22nd, 2007

      Assaf

      I pulled this out of Buildr, so I’m guessing directly in your Ruby Program.

    Your comment, here ⇓