GitHub Sale: sign up for any paid plan this week and pay nothing until January 1, 2009!  [ hide ]

public
Rubygem
Description: HTTP User Agent parser
Clone URL: git://github.com/josh/useragent.git
name age message
file MIT-LICENSE Sun Jul 27 13:06:19 -0700 2008 first commit [josh]
file README Sun Jul 27 13:06:19 -0700 2008 first commit [josh]
file init.rb Sun Jul 27 13:06:19 -0700 2008 first commit [josh]
directory lib/ Tue Sep 02 14:31:52 -0700 2008 Some Chrome love [josh]
directory spec/ Tue Sep 02 14:31:52 -0700 2008 Some Chrome love [josh]
file useragent.gemspec Sun Jul 27 13:10:18 -0700 2008 Fixed gemspec name [josh]
README
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 (c) 2008 Joshua Peek, released under the MIT license