Sha256: d07f827d54019842f5c7a91043037748bf41c33c57f6a46531998636d2af8b23

Contents?: true

Size: 529 Bytes

Versions: 3

Compression:

Stored size: 529 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 += " (#{os})" if os
      s
    end

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

  end
  
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
user_agent_parser-0.1.2 lib/user_agent_parser/user_agent.rb
user_agent_parser-0.1.1 lib/user_agent_parser/user_agent.rb
user_agent_parser-0.1.0 lib/user_agent_parser/user_agent.rb