Skip to content
HTTP User Agent parser
Ruby
Find file
Pull request Compare This branch is 2 commits ahead, 315 commits behind gshutler:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
lib
spec
.gitignore
LICENSE
README
Rakefile
useragent.gemspec

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) 2009 Joshua Peek, released under the MIT license
Something went wrong with that request. Please try again.