Class: AgentHelpers::Detector

Inherits:
Object
  • Object
show all
Defined in:
lib/agent_helpers/detector.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(args) ⇒ Detector

Returns a new instance of Detector.



4
5
6
7
8
9
10
11
# File 'lib/agent_helpers/detector.rb', line 4

def initialize(args)
  @request = args[:request]
  raise "No request was given." unless @request
  @env = @request.env
  @user_agent = @request.user_agent.to_s.downcase.strip
  raise "No user agent was given." if @user_agent.empty?
  parse
end

Instance Attribute Details

#browserObject (readonly)

Returns the value of attribute browser.



2
3
4
# File 'lib/agent_helpers/detector.rb', line 2

def browser
  @browser
end

#deviceObject (readonly)

Returns the value of attribute device.



2
3
4
# File 'lib/agent_helpers/detector.rb', line 2

def device
  @device
end

#titleObject (readonly)

Returns the value of attribute title.



2
3
4
# File 'lib/agent_helpers/detector.rb', line 2

def title
  @title
end

#versionObject (readonly)

Returns the value of attribute version.



2
3
4
# File 'lib/agent_helpers/detector.rb', line 2

def version
  @version
end