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