def parse string
      self.styles.inject(string) do |str, (name, options)|
        glyph, style = options[:match], options[:style]
        if glyph.is_a? Array
          str.gsub(/#{Regexp.escape(glyph.first)}(.*?)
                    #{Regexp.escape(glyph.last)}/x) { stylize $1, style }
        else
          str.gsub(/(#{Regexp.escape(glyph)}+)(.*?)\1/) { stylize $2, style }
        end
      end
    end
def parse string
      self.styles.inject(string) do |str, (name, options)|
        glyph, style = options[:match], options[:style]
        if glyph.is_a? Array
          str.gsub(/#{Regexp.escape(glyph.first)}(.*?)
                    #{Regexp.escape(glyph.last)}/x) { stylize $1, style }
        else
          str.gsub(/(#{Regexp.escape(glyph)}+)(.*?)\1/) { stylize $2, style }
        end
      end
    end
Parse a string to ANSI codes

   if the glyph is a pair, we match [0] as the start
   and [1] as the end marker.
   the matches are sent to +stylize+