Module: Rack::UserAgent::Detector

Includes:
Checker
Included in:
Request
Defined in:
lib/rack/user_agent/detector.rb

Constant Summary

Constants included from Result

Result::UNKNOWN_VARIANT

Instance Method Summary collapse

Methods included from Checker

#from_appliance?, #from_crawler?, #from_mobilephone?, #from_pc?, #from_smartphone?

Methods included from Result

#browser, #browser_vendor, #browser_version, #device_type, #device_variant, #os, #os_version

Instance Method Details

#from_android?Boolean

Returns:

  • (Boolean)


31
32
33
# File 'lib/rack/user_agent/detector.rb', line 31

def from_android?
  os == "Android" && android_mobile?
end

#from_android_os?Boolean

Returns:

  • (Boolean)


39
40
41
# File 'lib/rack/user_agent/detector.rb', line 39

def from_android_os?
  from_android? || from_android_tablet?
end

#from_android_tablet?Boolean

Returns:

  • (Boolean)


35
36
37
# File 'lib/rack/user_agent/detector.rb', line 35

def from_android_tablet?
  os == "Android" && !android_mobile?
end

#from_ios?Boolean

Returns:

  • (Boolean)


27
28
29
# File 'lib/rack/user_agent/detector.rb', line 27

def from_ios?
  from_iphone? || from_ipad? || from_ipod? || os == "iOS"
end

#from_ipad?Boolean

Returns:

  • (Boolean)


19
20
21
# File 'lib/rack/user_agent/detector.rb', line 19

def from_ipad?
  os == "iPad"
end

#from_iphone?Boolean

Returns:

  • (Boolean)


15
16
17
# File 'lib/rack/user_agent/detector.rb', line 15

def from_iphone?
  os == "iPhone"
end

#from_ipod?Boolean

Returns:

  • (Boolean)


23
24
25
# File 'lib/rack/user_agent/detector.rb', line 23

def from_ipod?
  os == "iPod"
end

#from_windows_phone?Boolean

Returns:

  • (Boolean)


43
44
45
# File 'lib/rack/user_agent/detector.rb', line 43

def from_windows_phone?
  os == "Windows Phone OS"
end

#smartphone_versionObject



10
11
12
13
# File 'lib/rack/user_agent/detector.rb', line 10

def smartphone_version
  return unless from_smartphone?
  suppress_unknown(os_version)
end