Sha256: 3c41a1aede7753a0409737a385b5804dacbae14dca704410f1c3ffd50b765622

Contents?: true

Size: 532 Bytes

Versions: 7

Compression:

Stored size: 532 Bytes

Contents

module UserAgentParser
  class OperatingSystem
    attr_reader :name, :version

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

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

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

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

    alias_method :==, :eql?
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
user_agent_parser-2.1.5 lib/user_agent_parser/operating_system.rb
user_agent_parser-2.1.4 lib/user_agent_parser/operating_system.rb
user_agent_parser-2.1.3 lib/user_agent_parser/operating_system.rb
user_agent_parser-2.1.2 lib/user_agent_parser/operating_system.rb
user_agent_parser-2.1.1 lib/user_agent_parser/operating_system.rb
user_agent_parser-2.1.0 lib/user_agent_parser/operating_system.rb
user_agent_parser-2.0.0 lib/user_agent_parser/operating_system.rb