Class: Rubyhexagon::Preview Private
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Class for post file data. This is mostly an abstraction to have data structures in a more Ruby like nature. This class just holds an adapted version of #save!, to handle the case of preview images having a different MD5 hash sum attribute than they actually should have. That is an e621 issue though.
Instance Attribute Summary
Attributes inherited from Image
#ext, #height, #md5, #size, #url, #width
Instance Method Summary collapse
-
#save!(dirname = './') ⇒ Object
private
Retrieve data from e621 and save it to file.
Methods inherited from Image
Constructor Details
This class inherits a constructor from Rubyhexagon::Image
Instance Method Details
#save!(dirname = './') ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Retrieve data from e621 and save it to file.
115 116 117 118 119 120 |
# File 'lib/rubyhexagon/image.rb', line 115 def save!(dirname = './') raise ArgumentError, 'Not a directory!' unless File.directory?(dirname) File.open("#{dirname}/#{File.basename(@url.path)}", 'w') do |f| f.print @url.open(@user_agent).read end end |