Sha256: 2df7f1338f15041723bb0c43d3d27894c5d4d3449bb59640b8c99b5fadba37bb
Contents?: true
Size: 904 Bytes
Versions: 3
Compression:
Stored size: 904 Bytes
Contents
# frozen_string_literal: true module UserAgentParser class UserAgent attr_reader :family, :version, :os, :device alias name family def initialize(family = nil, version = nil, os = nil, device = nil) @family = family || 'Other' @version = version @os = os @device = device end def to_s string = family string += " #{version}" if version string end def inspect string = to_s string += " (#{os})" if os string += " (#{device})" if device "#<#{self.class} #{string}>" end def eql?(other) self.class.eql?(other.class) && family == other.family && version == other.version && os == other.os end alias == eql? def to_h { device: device.to_h, family: family, os: os.to_h, version: version.to_h } end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
user_agent_parser-2.5.2 | lib/user_agent_parser/user_agent.rb |
user_agent_parser-2.5.1 | lib/user_agent_parser/user_agent.rb |
user_agent_parser-2.5.0 | lib/user_agent_parser/user_agent.rb |