Module: AgentHelpers::DetectorHelper

Defined in:
app/helpers/agent_helpers/detector_helper.rb

Instance Method Summary collapse

Instance Method Details

#agent_browserObject



18
19
20
# File 'app/helpers/agent_helpers/detector_helper.rb', line 18

def agent_browser
  agent_detector.browser
end

#agent_chrome?Boolean

Returns:

  • (Boolean)


42
43
44
# File 'app/helpers/agent_helpers/detector_helper.rb', line 42

def agent_chrome?
  agent_detector.browser == :chrome
end

#agent_detectorObject



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_deviceObject



34
35
36
# File 'app/helpers/agent_helpers/detector_helper.rb', line 34

def agent_device
  agent_detector.device
end

#agent_firefox?Boolean

Returns:

  • (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

Returns:

  • (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

Returns:

  • (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

Returns:

  • (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

Returns:

  • (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

Returns:

  • (Boolean)


58
59
60
# File 'app/helpers/agent_helpers/detector_helper.rb', line 58

def agent_opera?
  agent_detector.browser == :opera
end

#agent_osObject



38
39
40
# File 'app/helpers/agent_helpers/detector_helper.rb', line 38

def agent_os
  agent_detector.os
end

#agent_os_titleObject



82
83
84
# File 'app/helpers/agent_helpers/detector_helper.rb', line 82

def agent_os_title
  agent_detector.os_title
end

#agent_os_versionObject



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

Returns:

  • (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

Returns:

  • (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

Returns:

  • (Boolean)


54
55
56
# File 'app/helpers/agent_helpers/detector_helper.rb', line 54

def agent_safari?
  agent_detector.browser == :safari
end

#agent_titleObject



22
23
24
# File 'app/helpers/agent_helpers/detector_helper.rb', line 22

def agent_title
  agent_detector.title
end

#agent_versionObject



26
27
28
# File 'app/helpers/agent_helpers/detector_helper.rb', line 26

def agent_version
  agent_detector.version
end

#agent_version_majorObject



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

Returns:

  • (Boolean)


66
67
68
# File 'app/helpers/agent_helpers/detector_helper.rb', line 66

def agent_windows?
  agent_detector.os == :windows
end