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.
Class Method Summary collapse
-
.map(name, options = {}) ⇒ Object
Map agent name to options.
Instance Method Summary collapse
-
#==(other) ⇒ Object
Check if the agent is the same as other agent.
-
#initialize(user_agent) ⇒ UserAgent
constructor
Initialize with user agent user_agent.
-
#inspect ⇒ Object
Inspect.
-
#to_s ⇒ Object
User agent user_agent.
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 |
Class Method Details
.map(name, options = {}) ⇒ Object
Map agent name to options.
40 41 42 |
# File 'lib/active_device/user_agent.rb', line 40 def self.map name, = {} @agents << [name, ] end |
Instance Method Details
#==(other) ⇒ Object
Check if the agent is the same as other agent.
31 32 33 |
# File 'lib/active_device/user_agent.rb', line 31 def == other user_agent == other.user_agent end |
#inspect ⇒ Object
Inspect.
24 25 26 |
# File 'lib/active_device/user_agent.rb', line 24 def inspect "#<Agent:#{name} version:#{version.inspect} engine:\"#{engine.to_s}:#{engine_version}\" os:#{os.to_s.inspect}>" end |
#to_s ⇒ Object
User agent user_agent.
17 18 19 |
# File 'lib/active_device/user_agent.rb', line 17 def to_s user_agent end |