public
Description: HTTP User Agent parser
Homepage: http://rdoc.info/projects/josh/useragent/
Clone URL: git://github.com/josh/useragent.git
name age message
file .gitignore Thu Oct 01 08:35:08 -0700 2009 ignore pkg/ dir [josh]
file LICENSE Thu Oct 01 08:21:23 -0700 2009 rename to just LICENSE [josh]
file README.rdoc Sun Dec 06 10:38:57 -0800 2009 reformat readme [josh]
file Rakefile Sun Dec 06 10:18:41 -0800 2009 no mg [josh]
directory lib/ Fri Dec 18 07:05:43 -0800 2009 Added Chrome Frame detection to the Internet Ex... [precipice]
directory spec/ Fri Dec 18 01:30:17 -0800 2009 Added Chrome Frame detection to the Internet Ex... [precipice]
file useragent.gemspec Fri Dec 18 07:06:53 -0800 2009 0.1.4 release [josh]
README.rdoc

UserAgent

UserAgent is a Ruby library that parses and compares HTTP User Agents.

Example

  Browser = Struct.new(:browser, :version)
  SupportedBrowsers = [
    Browser.new("Safari", "3.1.1"),
    Browser.new("Firefox", "2.0.0.14"),
    Browser.new("Internet Explorer", "7.0")
  ]

  user_agent = UserAgent.parse(request.user_agent)
  SupportedBrowsers.detect { |browser| user_agent >= browser }

Copyright © 2009 Joshua Peek, released under the MIT license