arentweallhorses arentweallhorses - 1 year ago 94
Ruby Question

Save WWW::Mechanize::File to disk using FileUtils

Using Mechanize with Ruby I get a certain file using

, with FileUtils or otherwise, how do I save this file to my hard drive (for instance, in a directory wherefrom the script is running)?

class => WWW::Mechanize::File

Answer Source

Well, WWW::Mechanize::File has a save_as instance method, so I suppose something like this might work:

agent.get('').save_as 'a_file_name'
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download