def build_ansi_methods(hash)
      hash.each do |key, value|

        define_method(key) do |string=nil, &block|
          result = Array.new

          result << %(\e[#{value}m)
          if block_given?
            result << block.call
          elsif string.respond_to?(:to_str)
            result << string.to_str
          elsif respond_to?(:to_str)
            result << to_str
          else
            return result
          end
          result << %(\e[0m)

          result.join
        end
      end

      true
    end
def build_ansi_methods(hash)
      hash.each do |key, value|

        define_method(key) do |string=nil, &block|
          result = Array.new

          result << %(\e[#{value}m)
          if block_given?
            result << block.call
          elsif string.respond_to?(:to_str)
            result << string.to_str
          elsif respond_to?(:to_str)
            result << to_str
          else
            return result
          end
          result << %(\e[0m)

          result.join
        end
      end

      true
    end
Dynamicly constructs ANSI methods for the color methods based on the ANSI
 code hash passed in.

 @param [Hash] hash
   A hash where the keys represent the method names and the values are the
   ANSI codes.

 @return [Boolean]
   True if successful.