Class: UserAgentParser::Device

Inherits:
Object
  • Object
show all
Defined in:
lib/user_agent_parser/device.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name = nil) ⇒ Device

Returns a new instance of Device.



5
6
7
# File 'lib/user_agent_parser/device.rb', line 5

def initialize(name = nil)
  @name = name || 'Other'
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



3
4
5
# File 'lib/user_agent_parser/device.rb', line 3

def name
  @name
end

Instance Method Details

#eql?(other) ⇒ Boolean Also known as: ==

Returns:

  • (Boolean)


17
18
19
# File 'lib/user_agent_parser/device.rb', line 17

def eql?(other)
  self.class.eql?(other.class) && name == other.name
end

#inspectObject



13
14
15
# File 'lib/user_agent_parser/device.rb', line 13

def inspect
  "#<#{self.class} #{to_s}>"
end

#to_sObject



9
10
11
# File 'lib/user_agent_parser/device.rb', line 9

def to_s
  name
end