/usr/lib/ruby/vendor_ruby/mechanize/cookie.rb is in ruby-mechanize 2.7.2-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 | warn 'mechanize/cookie will be deprecated. Please migrate to the http-cookie APIs.' if $VERBOSE
require 'http/cookie'
class Mechanize
module CookieDeprecated
def __deprecated__(to = nil)
$VERBOSE or return
method = caller[0][/([^`]+)(?='$)/]
to ||= method
case self
when Class
lname = name[/[^:]+$/]
klass = 'Mechanize::%s' % lname
this = '%s.%s' % [klass, method]
that = 'HTTP::%s.%s' % [lname, to]
else
lname = self.class.name[/[^:]+$/]
klass = 'Mechanize::%s' % lname
this = '%s#%s' % [klass, method]
that = 'HTTP::%s#%s' % [lname, to]
end
warn '%s: The call of %s needs to be fixed to follow the new API (%s).' % [caller[1], this, that]
end
private :__deprecated__
end
module CookieCMethods
include CookieDeprecated
def parse(arg1, arg2, arg3 = nil, &block)
if arg1.is_a?(URI)
__deprecated__
return [] if arg2.nil?
super(arg2, arg1, { :logger => arg3 })
else
super
end
end
end
module CookieIMethods
include CookieDeprecated
def set_domain(domain)
__deprecated__ :domain=
@domain = domain
end
end
Cookie = ::HTTP::Cookie
# Compatibility for Ruby 1.8/1.9
unless Cookie.respond_to?(:prepend, true)
require 'mechanize/prependable'
class Cookie
extend Prependable
class << self
extend Prependable
end
end
end
class Cookie
prepend CookieIMethods
class << self
prepend CookieCMethods
end
end
end
|