Sha256: 319bac19d2938c26e7225b0d878408413347508d4936d03a849516f222e288f6

Contents?: true

Size: 541 Bytes

Versions: 2

Compression:

Stored size: 541 Bytes

Contents

module UserAgentParser

  class UserAgent

    attr_accessor :family, :version, :os

    def initialize(family="Other", version=nil, os=nil)
      self.family = family
      self.version = version
      self.os = os
    end

    def to_s
      s = family
      s += " #{version}" if version
      s
    end

    def inspect
      s = to_s
      s += " (#{os})" if os
      "#<#{self.class} #{s}>"
    end
    
    def ==(other)
      family == other.family &&
        version == other.version &&
        os == other.os
    end

  end
  
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
user_agent_parser-1.0.2 lib/user_agent_parser/user_agent.rb
user_agent_parser-1.0.1 lib/user_agent_parser/user_agent.rb