Sha256: 1715157f31da13bba90e6a982e18311b4bfb3ddc1a57d3aa54dfbc0e3564a080

Contents?: true

Size: 579 Bytes

Versions: 5

Compression:

Stored size: 579 Bytes

Contents

module UserAgentParser
  class OperatingSystem
    attr_reader :family, :version

    alias_method :name, :family

    def initialize(family = 'Other', version = nil)
      @family = family
      @version = version
    end

    def to_s
      string = family
      unless version.nil?
        string += " #{version}"
      end
      string
    end

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

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

    alias_method :==, :eql?
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
user_agent_parser-2.4.0 lib/user_agent_parser/operating_system.rb
user_agent_parser-2.3.2 lib/user_agent_parser/operating_system.rb
user_agent_parser-2.3.1 lib/user_agent_parser/operating_system.rb
user_agent_parser-2.3.0 lib/user_agent_parser/operating_system.rb
user_agent_parser-2.2.0 lib/user_agent_parser/operating_system.rb