def irc_format!(*settings, string)
      string = string.dup

      attributes = settings.select {|k| @@attributes.has_key?(k)}.map {|k| @@attributes[k]}
      colors = settings.select {|k| @@colors.has_key?(k)}.map {|k| @@colors[k]}
      if colors.size > 2
        raise ArgumentError, "At most two colors (foreground and background) might be specified"
      end

      attribute_string = attributes.join
      color_string = if colors.empty?
                       ""
                     else
                       "\x03#{colors.join(",")}"
                     end

      prepend = attribute_string + color_string
      append = @@attributes[:reset]

      # attributes act as toggles, so e.g. underline+underline = no
      # underline. We thus have to delete all duplicate attributes
      # from nested strings.
      string.delete!(attribute_string)

      # Replace the reset code of nested strings to continue the
      # formattings of the outer string.
      string.gsub!(/#{@@attributes[:reset]}/, @@attributes[:reset] + prepend)
      string.insert(0, prepend)
      string << append
      return string
    end
def irc_format!(*settings, string)
      string = string.dup

      attributes = settings.select {|k| @@attributes.has_key?(k)}.map {|k| @@attributes[k]}
      colors = settings.select {|k| @@colors.has_key?(k)}.map {|k| @@colors[k]}
      if colors.size > 2
        raise ArgumentError, "At most two colors (foreground and background) might be specified"
      end

      attribute_string = attributes.join
      color_string = if colors.empty?
                       ""
                     else
                       "\x03#{colors.join(",")}"
                     end

      prepend = attribute_string + color_string
      append = @@attributes[:reset]

      # attributes act as toggles, so e.g. underline+underline = no
      # underline. We thus have to delete all duplicate attributes
      # from nested strings.
      string.delete!(attribute_string)

      # Replace the reset code of nested strings to continue the
      # formattings of the outer string.
      string.gsub!(/#{@@attributes[:reset]}/, @@attributes[:reset] + prepend)
      string.insert(0, prepend)
      string << append
      return string
    end
Apply IRC formatting codes to a string, modifying it in place.
 @param [*Array] settings A list of color and formatting attributes you
   want to apply.
 @param [String] string A string you want to format.
 @return [String] A formatted string.