Class: UserAgentParser::OperatingSystem
- Inherits:
-
Object
- Object
- UserAgentParser::OperatingSystem
- Defined in:
- lib/user_agent_parser/operating_system.rb
Instance Attribute Summary collapse
-
#family ⇒ Object
(also: #name)
readonly
Returns the value of attribute family.
-
#version ⇒ Object
readonly
Returns the value of attribute version.
Instance Method Summary collapse
- #eql?(other) ⇒ Boolean (also: #==)
-
#initialize(family = 'Other', version = nil) ⇒ OperatingSystem
constructor
A new instance of OperatingSystem.
- #inspect ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(family = 'Other', version = nil) ⇒ OperatingSystem
Returns a new instance of OperatingSystem.
7 8 9 10 |
# File 'lib/user_agent_parser/operating_system.rb', line 7 def initialize(family = 'Other', version = nil) @family = family @version = version end |
Instance Attribute Details
#family ⇒ Object (readonly) Also known as: name
Returns the value of attribute family.
3 4 5 |
# File 'lib/user_agent_parser/operating_system.rb', line 3 def family @family end |
#version ⇒ Object (readonly)
Returns the value of attribute version.
3 4 5 |
# File 'lib/user_agent_parser/operating_system.rb', line 3 def version @version end |
Instance Method Details
#eql?(other) ⇒ Boolean Also known as: ==
24 25 26 27 28 |
# File 'lib/user_agent_parser/operating_system.rb', line 24 def eql?(other) self.class.eql?(other.class) && family == other.family && version == other.version end |
#inspect ⇒ Object
20 21 22 |
# File 'lib/user_agent_parser/operating_system.rb', line 20 def inspect "#<#{self.class} #{to_s}>" end |
#to_s ⇒ Object
12 13 14 15 16 17 18 |
# File 'lib/user_agent_parser/operating_system.rb', line 12 def to_s string = family unless version.nil? string += " #{version}" end string end |