Popularity
4.1
Stable
Activity
0.0
Stable
175
6
160

Code Quality Rank: L4
Monthly Downloads: 326,158
Programming language: Ruby
License: MIT License
Tags: HTTP     Utilities     User Agent Detection     Web     Web Apps     Services     Interaction    
Latest version: v0.16.10

UserAgent alternatives and similar gems

Based on the "User Agent Detection" category.
Alternatively, view UserAgent alternatives based on common mentions on social networks and blogs.

Do you think we are missing an alternative of UserAgent or a related project?

Add another 'User Agent Detection' Gem

README

UserAgent

Build Status Gem Version

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

Installation

gem install useragent

Examples

Reporting

string = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_6_8) AppleWebKit/536.5 (KHTML, like Gecko) Chrome/19.0.1084.56 Safari/536.5'
user_agent = UserAgent.parse(string)
user_agent.browser
# => 'Chrome'
user_agent.version
# => '19.0.1084.56'
user_agent.platform
# => 'Macintosh'

Comparison

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) 2015-2019 Garry Shutler, released under the MIT license


*Note that all licence references and agreements mentioned in the UserAgent README section above are relevant to that project's source code only.