Module: Rack::SimpleUserAgent::Detectors::Smartphone

Included in:
Rack::SimpleUserAgent::Detectors
Defined in:
lib/rack/simple_user_agent/detectors/smartphone.rb

Instance Method Summary collapse

Instance Method Details

#from_android?Boolean

Returns:

  • (Boolean)


25
26
27
# File 'lib/rack/simple_user_agent/detectors/smartphone.rb', line 25

def from_android?
  user_agent_string.include?("Android")
end

#from_android_mobile?Boolean

Returns:

  • (Boolean)


33
34
35
# File 'lib/rack/simple_user_agent/detectors/smartphone.rb', line 33

def from_android_mobile?
  from_android? && android_mobile?
end

#from_android_tablet?Boolean

Returns:

  • (Boolean)


29
30
31
# File 'lib/rack/simple_user_agent/detectors/smartphone.rb', line 29

def from_android_tablet?
  from_android? && !android_mobile?
end

#from_ios?Boolean

Returns:

  • (Boolean)


9
10
11
# File 'lib/rack/simple_user_agent/detectors/smartphone.rb', line 9

def from_ios?
  from_iphone? || from_ipad? || from_ipod?
end

#from_ipad?Boolean

Returns:

  • (Boolean)


17
18
19
# File 'lib/rack/simple_user_agent/detectors/smartphone.rb', line 17

def from_ipad?
  user_agent_string.include?("iPad")
end

#from_iphone?Boolean

Returns:

  • (Boolean)


13
14
15
# File 'lib/rack/simple_user_agent/detectors/smartphone.rb', line 13

def from_iphone?
  user_agent_string.include?("iPhone")
end

#from_ipod?Boolean

Returns:

  • (Boolean)


21
22
23
# File 'lib/rack/simple_user_agent/detectors/smartphone.rb', line 21

def from_ipod?
  user_agent_string.include?("iPod")
end

#from_smartphone?Boolean

Returns:

  • (Boolean)


5
6
7
# File 'lib/rack/simple_user_agent/detectors/smartphone.rb', line 5

def from_smartphone?
  from_ios? || from_android? || from_windows_phone?
end

#from_windows_phone?Boolean

Returns:

  • (Boolean)


37
38
39
# File 'lib/rack/simple_user_agent/detectors/smartphone.rb', line 37

def from_windows_phone?
  user_agent_string.include?("Windows Phone")
end