User Agent inspection: finding the client browser name

Here is a short snippet of Ruby code that I wrote today to detect client browser types. (to override CSS styles based on client browsers..) Hope it helps.

  def client_browser_name(user_agent_string)
    case user_agent_string
    when /msie 6/i
    when /msie 7/i
    when /msie 8/i
    when /konqueror/i
    when /firefox\/2/i
    when /firefox\/3/i
    when /applewebkit/i
    when /gecko/i       #generic case where FireFox is not in String (ie. MindField, BonEcho, GranParadiso)
    when /opera/i