Module: AgentHelpers::DetectorHelper
- Defined in:
- app/helpers/agent_helpers/detector_helper.rb
Instance Method Summary collapse
- #agent_browser ⇒ Object
- #agent_chrome? ⇒ Boolean
- #agent_detector ⇒ Object
- #agent_device ⇒ Object
- #agent_firefox? ⇒ Boolean
- #agent_human? ⇒ Boolean
- #agent_ie? ⇒ Boolean
- #agent_linux? ⇒ Boolean
- #agent_mobile? ⇒ Boolean
- #agent_opera? ⇒ Boolean
- #agent_os ⇒ Object
- #agent_os_title ⇒ Object
- #agent_os_version ⇒ Object
- #agent_osx? ⇒ Boolean
- #agent_robot? ⇒ Boolean
- #agent_safari? ⇒ Boolean
- #agent_title ⇒ Object
- #agent_version ⇒ Object
- #agent_version_major ⇒ Object
- #agent_windows? ⇒ Boolean
Instance Method Details
#agent_browser ⇒ Object
18 19 20 |
# File 'app/helpers/agent_helpers/detector_helper.rb', line 18 def agent_browser agent_detector.browser end |
#agent_chrome? ⇒ Boolean
42 43 44 |
# File 'app/helpers/agent_helpers/detector_helper.rb', line 42 def agent_chrome? agent_detector.browser == :chrome end |
#agent_detector ⇒ Object
2 3 4 5 6 7 8 |
# File 'app/helpers/agent_helpers/detector_helper.rb', line 2 def agent_detector if !controller.instance_variable_get(:@agent_helpers_detector) controller.instance_variable_set(:@agent_helpers_detector, ::AgentHelpers::Detector.new(:request => request)) end return controller.instance_variable_get(:@agent_helpers_detector) end |
#agent_device ⇒ Object
34 35 36 |
# File 'app/helpers/agent_helpers/detector_helper.rb', line 34 def agent_device agent_detector.device end |
#agent_firefox? ⇒ Boolean
46 47 48 |
# File 'app/helpers/agent_helpers/detector_helper.rb', line 46 def agent_firefox? agent_detector.browser == :firefox end |
#agent_human? ⇒ Boolean
14 15 16 |
# File 'app/helpers/agent_helpers/detector_helper.rb', line 14 def agent_human? agent_detector.browser != :bot && agent_detector.browser != :unknown end |
#agent_ie? ⇒ Boolean
50 51 52 |
# File 'app/helpers/agent_helpers/detector_helper.rb', line 50 def agent_ie? agent_detector.browser == :ie end |
#agent_linux? ⇒ Boolean
70 71 72 |
# File 'app/helpers/agent_helpers/detector_helper.rb', line 70 def agent_linux? agent_detector.os == :linux end |
#agent_mobile? ⇒ Boolean
62 63 64 |
# File 'app/helpers/agent_helpers/detector_helper.rb', line 62 def agent_mobile? agent_detector.os == :android || agent_detector.os == :ios end |
#agent_opera? ⇒ Boolean
58 59 60 |
# File 'app/helpers/agent_helpers/detector_helper.rb', line 58 def agent_opera? agent_detector.browser == :opera end |
#agent_os ⇒ Object
38 39 40 |
# File 'app/helpers/agent_helpers/detector_helper.rb', line 38 def agent_os agent_detector.os end |
#agent_os_title ⇒ Object
82 83 84 |
# File 'app/helpers/agent_helpers/detector_helper.rb', line 82 def agent_os_title agent_detector.os_title end |
#agent_os_version ⇒ Object
78 79 80 |
# File 'app/helpers/agent_helpers/detector_helper.rb', line 78 def agent_os_version agent_detector.os_version end |
#agent_osx? ⇒ Boolean
74 75 76 |
# File 'app/helpers/agent_helpers/detector_helper.rb', line 74 def agent_osx? agent_detector.os == :osx end |
#agent_robot? ⇒ Boolean
10 11 12 |
# File 'app/helpers/agent_helpers/detector_helper.rb', line 10 def agent_robot? agent_detector.browser == :bot end |
#agent_safari? ⇒ Boolean
54 55 56 |
# File 'app/helpers/agent_helpers/detector_helper.rb', line 54 def agent_safari? agent_detector.browser == :safari end |
#agent_title ⇒ Object
22 23 24 |
# File 'app/helpers/agent_helpers/detector_helper.rb', line 22 def agent_title agent_detector.title end |
#agent_version ⇒ Object
26 27 28 |
# File 'app/helpers/agent_helpers/detector_helper.rb', line 26 def agent_version agent_detector.version end |
#agent_version_major ⇒ Object
30 31 32 |
# File 'app/helpers/agent_helpers/detector_helper.rb', line 30 def agent_version_major agent_detector.version_major end |
#agent_windows? ⇒ Boolean
66 67 68 |
# File 'app/helpers/agent_helpers/detector_helper.rb', line 66 def agent_windows? agent_detector.os == :windows end |