Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
Ruby で Mechanize を使用するagent.get('http://example.com/foo.torrent')と、FileUtils などを使用して特定のファイルを取得できます。このファイルをハード ドライブ (たとえば、スクリプトが実行されているディレクトリ) に保存するにはどうすればよいですか?
agent.get('http://example.com/foo.torrent')
PSclass => WWW::Mechanize::File
class => WWW::Mechanize::File
さて、WWW::Mechanize::Fileインスタンスsave_asメソッドがあるので、次のようなものが機能すると思います。
WWW::Mechanize::File
save_as
agent.get('http://example.com/foo.torrent').save_as 'a_file_name'