/usr/lib/ruby/vendor_ruby/mechanize/file_saver.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 | ##
# This is a pluggable parser that automatically saves every file it
# encounters. Unlike Mechanize::DirectorySaver, the file saver saves the
# responses as a tree, reflecting the host and file path.
#
# == Example
#
# This example saves all .pdf files
#
# require 'mechanize'
#
# agent = Mechanize.new
# agent.pluggable_parser.pdf = Mechanize::FileSaver
# agent.get 'http://example.com/foo.pdf'
#
# Dir['example.com/*'] # => foo.pdf
class Mechanize::FileSaver < Mechanize::Download
attr_reader :filename
def initialize uri = nil, response = nil, body_io = nil, code = nil
@full_path = true
super
save @filename
end
##
# The save_as alias is provided for backwards compatibility with mechanize
# 2.0. It will be removed in mechanize 3.
#--
# TODO remove in mechanize 3
alias save_as save
end
|