<=>(other)
click to toggle source
def <=>(other)
if respond_to?(:browser) && other.respond_to?(:browser) &&
browser == other.browser
version <=> Version.new(other.version)
else
false
end
end
application()
click to toggle source
def application
first
end
bot?()
click to toggle source
def bot?
if application.nil?
true
elsif comment = application.comment
comment.any? { |c| c =~ /bot/ }
elsif product = application.product
product.include?('bot')
else
false
end
end
browser()
click to toggle source
def browser
application && application.product
end
eql?(other)
click to toggle source
def eql?(other)
self == other
end
method_missing(method, *args, &block)
click to toggle source
Calls superclass method
def method_missing(method, *args, &block)
detect_product(method) || super
end
mobile?()
click to toggle source
def mobile?
if detect_product('Mobile') || detect_comment('Mobile')
true
elsif os =~ /Android/
true
elsif application && application.detect_comment { |c| c =~ /^IEMobile/ }
true
else
false
end
end
os()
click to toggle source
respond_to?(symbol, include_all = false)
click to toggle source
Calls superclass method
def respond_to?(symbol, include_all = false)
detect_product(symbol) ? true : super
end
to_h()
click to toggle source
def to_h
return unless application
hash = {
:browser => browser,
:platform => platform,
:os => os,
:mobile => mobile?,
:bot => bot?,
}
if version
hash[:version] = version.to_a
else
hash[:version] = nil
end
if comment = application.comment
hash[:comment] = comment.dup
else
hash[:comment] = nil
end
hash
end
to_s()
click to toggle source
to_str()
click to toggle source
version()
click to toggle source
def version
application && application.version
end