Class: JustInform::Downloader

Inherits:
Object
  • Object
show all
Defined in:
lib/just_inform/downloader.rb

Class Method Summary collapse

Class Method Details

.get_latestObject



6
7
8
9
10
11
12
13
14
15
# File 'lib/just_inform/downloader.rb', line 6

def self.get_latest
  if self.current_file?
    puts "Using downloaded file"
    latest = File.open(File.join 'data', self.current_filename)
  else
    puts 'Downloading file, this could take a minute...'
    latest = File.open(File.join('data',self.current_filename), 'wb') {|file| file << open('http://www.reginfo.gov/public/do/PRAXML?type=inventory').read}
    latest = File.open(File.join 'data', self.current_filename)
  end
end