module JekyllRemotePlantUMLPlugin::Utils::Common

Public Instance Methods

download_image(url, dest_path) click to toggle source
# File lib/jekyll_remote_plantuml_plugin/utils.rb, line 7
def download_image(url, dest_path)
  dest_dir = File.dirname(dest_path)
  FileUtils.mkdir_p(dest_dir) unless File.directory?(dest_dir)

  uri = URI.parse(url)
  uri.open do |f|
    File.open(dest_path, "wb") do |file|
      file << f.read
    end
  end
end