Sha256: 2095c88611421edb1b667f689b012551d64cd2b221237f523d47a324d2a78091
Contents?: true
Size: 1.08 KB
Versions: 1
Compression:
Stored size: 1.08 KB
Contents
require 'nitro/context' module Nitro module Request # Some useful mini methods for browser testing. # TODO: add testing for mac IE (an other platforms) # Different servers hold user agent in differnet # strings (unify this). def user_agent headers['HTTP_USER_AGENT'] || headers['USER-AGENT'] end def from_gecko? user_agent =~ /Gecko/ end alias_method :from_mozilla?, :from_gecko? def from_ie? user_agent =~ /MSIE/ end alias_method :from_msie?, :from_ie? def from_opera? user_agent =~ /Opera/ end def from_khtml? user_agent =~ /KTHML/ end alias_method :from_safari?, :from_khtml? def from_w3c? from_gecko? or from_khtml? or from_opera? end def from_osx? user_agent =~ /Mac OS X/ or user_agent =~ /Mac_PowerPC/ end def from_os9? end def from_mac? from_osx? or from_os9? end def from_unix? user_agent =~ /linux/ or user_agent =~ /FreeBSD/ end alias_method :from_linux?, :from_unix? def from_windows? user_agent =~ /Windows/ end end end # * Chris Farmiloe <chris.farmiloe@farmiloe.com>
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
nitro-0.26.0 | lib/nitro/cgi/utils.rb |