Class: UserAgent
- Inherits:
-
Object
- Object
- UserAgent
- Defined in:
- lib/active_device/user_agent.rb
Instance Attribute Summary collapse
-
#user_agent ⇒ Object
readonly
User agent user_agent.
Instance Method Summary collapse
-
#==(other) ⇒ Object
Check if the agent is the same as other agent.
-
#brand ⇒ Object
User agent brand symbol.
-
#engine ⇒ Object
User agent engine symbol.
-
#engine_version ⇒ Object
User agent engine version user_agent.
-
#initialize(user_agent) ⇒ UserAgent
constructor
Initialize with user agent user_agent.
-
#inspect ⇒ Object
Inspect.
- #is_handset?(model) ⇒ Boolean
- #is_mobile? ⇒ Boolean
-
#model ⇒ Object
User agent model symbol.
-
#model_reselution ⇒ Object
User agent model Reselution symbol.
-
#name ⇒ Object
User agent name symbol.
-
#os ⇒ Object
User agent os symbol.
-
#os_series ⇒ Object
User agent engine version user_agent.
-
#os_version ⇒ Object
User agent engine version user_agent.
-
#to_s ⇒ Object
User agent user_agent.
-
#version ⇒ Object
User agent version.
Constructor Details
#initialize(user_agent) ⇒ UserAgent
Initialize with user agent user_agent.
10 11 12 |
# File 'lib/active_device/user_agent.rb', line 10 def initialize user_agent @user_agent = user_agent.strip end |
Instance Attribute Details
#user_agent ⇒ Object (readonly)
User agent user_agent.
5 6 7 |
# File 'lib/active_device/user_agent.rb', line 5 def user_agent @user_agent end |
Instance Method Details
#==(other) ⇒ Object
Check if the agent is the same as other agent.
113 114 115 |
# File 'lib/active_device/user_agent.rb', line 113 def == other user_agent == other.user_agent end |
#brand ⇒ Object
User agent brand symbol.
84 85 86 |
# File 'lib/active_device/user_agent.rb', line 84 def brand Brand.mobile_brand user_agent end |
#engine ⇒ Object
User agent engine symbol.
35 36 37 |
# File 'lib/active_device/user_agent.rb', line 35 def engine AgentSpec.engine_for_user_agent user_agent end |
#engine_version ⇒ Object
User agent engine version user_agent.
42 43 44 |
# File 'lib/active_device/user_agent.rb', line 42 def engine_version AgentSpec.engine_version_for_user_agent user_agent end |
#inspect ⇒ Object
Inspect.
106 107 108 |
# File 'lib/active_device/user_agent.rb', line 106 def inspect "#<Agent:#{name} version:#{version.inspect} engine:\"#{engine.to_s}:#{engine_version}\" os:#{os.to_s.inspect}>" end |
#is_handset?(model) ⇒ Boolean
92 93 94 |
# File 'lib/active_device/user_agent.rb', line 92 def is_handset? model Handset.is_handset? user_agent, model end |
#is_mobile? ⇒ Boolean
88 89 90 |
# File 'lib/active_device/user_agent.rb', line 88 def is_mobile? Handset.is_mobile? user_agent end |
#model ⇒ Object
User agent model symbol.
70 71 72 |
# File 'lib/active_device/user_agent.rb', line 70 def model Model.brand_model user_agent end |
#model_reselution ⇒ Object
User agent model Reselution symbol.
77 78 79 |
# File 'lib/active_device/user_agent.rb', line 77 def model_reselution Model.model_reselution user_agent end |
#name ⇒ Object
User agent name symbol.
21 22 23 |
# File 'lib/active_device/user_agent.rb', line 21 def name AgentSpec.name_for_user_agent user_agent end |
#os ⇒ Object
User agent os symbol.
49 50 51 |
# File 'lib/active_device/user_agent.rb', line 49 def os AgentSpec.os_for_user_agent user_agent end |
#os_series ⇒ Object
User agent engine version user_agent.
63 64 65 |
# File 'lib/active_device/user_agent.rb', line 63 def os_series AgentSpec.os_series_for_user_agent user_agent end |
#os_version ⇒ Object
User agent engine version user_agent.
56 57 58 |
# File 'lib/active_device/user_agent.rb', line 56 def os_version AgentSpec.os_version_for_user_agent user_agent end |
#to_s ⇒ Object
User agent user_agent.
99 100 101 |
# File 'lib/active_device/user_agent.rb', line 99 def to_s user_agent end |
#version ⇒ Object
User agent version.
28 29 30 |
# File 'lib/active_device/user_agent.rb', line 28 def version AgentSpec.version_for_user_agent user_agent end |