Module: CableGator

Defined in:
lib/cablegator.rb

Class Method Summary collapse

Class Method Details

.save_file(pathname) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
# File 'lib/cablegator.rb', line 11

def self.save_file(pathname)
  require 'fileutils'
  save_file = File.expand_path(pathname)
  FileUtils.mkdir_p(File.dirname(save_file))

  tweeted = File.read(save_file).split(',') rescue []
  at_exit do
    File.open(save_file, 'w') { |f| f << tweeted.join(',') }
  end
  tweeted
end