Class: UserAgentParser::Device
- Inherits:
-
Object
- Object
- UserAgentParser::Device
- Defined in:
- lib/user_agent_parser/device.rb
Instance Attribute Summary collapse
-
#brand ⇒ Object
readonly
Returns the value of attribute brand.
-
#family ⇒ Object
(also: #name)
readonly
Returns the value of attribute family.
-
#model ⇒ Object
readonly
Returns the value of attribute model.
Instance Method Summary collapse
- #eql?(other) ⇒ Boolean (also: #==)
-
#initialize(family = nil, model = nil, brand = nil) ⇒ Device
constructor
A new instance of Device.
- #inspect ⇒ Object
- #to_h ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(family = nil, model = nil, brand = nil) ⇒ Device
Returns a new instance of Device.
9 10 11 12 13 |
# File 'lib/user_agent_parser/device.rb', line 9 def initialize(family = nil, model = nil, brand = nil) @family = family || 'Other' @model = model || @family @brand = brand end |
Instance Attribute Details
#brand ⇒ Object (readonly)
Returns the value of attribute brand.
5 6 7 |
# File 'lib/user_agent_parser/device.rb', line 5 def brand @brand end |
#family ⇒ Object (readonly) Also known as: name
Returns the value of attribute family.
5 6 7 |
# File 'lib/user_agent_parser/device.rb', line 5 def family @family end |
#model ⇒ Object (readonly)
Returns the value of attribute model.
5 6 7 |
# File 'lib/user_agent_parser/device.rb', line 5 def model @model end |
Instance Method Details
#eql?(other) ⇒ Boolean Also known as: ==
23 24 25 |
# File 'lib/user_agent_parser/device.rb', line 23 def eql?(other) self.class.eql?(other.class) && family == other.family end |
#inspect ⇒ Object
19 20 21 |
# File 'lib/user_agent_parser/device.rb', line 19 def inspect "#<#{self.class} #{self}>" end |
#to_h ⇒ Object
29 30 31 32 33 34 35 |
# File 'lib/user_agent_parser/device.rb', line 29 def to_h { family: family, model: model, brand: brand } end |
#to_s ⇒ Object
15 16 17 |
# File 'lib/user_agent_parser/device.rb', line 15 def to_s family end |