class MultibyteTestHelpers::Downloader

Public Class Methods

download(from, to) click to toggle source
# File activesupport/test/multibyte_test_helpers.rb, line 5
def self.download(from, to)
  unless File.exist?(to)
    unless File.exist?(File.dirname(to))
      system "mkdir -p #{File.dirname(to)}"
    end
    open(from) do |source|
      File.open(to, "w") do |target|
        source.each_line do |l|
          target.write l
        end
      end
    end
  end
  true
end