Module: GoobyIO

Included in:
GoobyBaseObject, GoobyProcess
Defined in:
lib/gooby_io.rb

Overview

Gooby = Google APIs + Ruby. Copyright 2009 by Chris Joakim. Gooby is available under GNU General Public License (GPL) license.

Instance Method Summary collapse

Instance Method Details

#read_file_as_lines(filename) ⇒ Object



10
11
12
# File 'lib/gooby_io.rb', line 10

def read_file_as_lines(filename)
  IO.readlines(filename)
end

#write_file(out_name, content, mode = 'w+') ⇒ Object



23
24
25
26
27
28
# File 'lib/gooby_io.rb', line 23

def write_file(out_name, content, mode='w+')
  out = File.new out_name, mode
  out.write content
  out.flush
  out.close
end

#write_lines(out_name, lines) ⇒ Object



14
15
16
17
18
19
20
21
# File 'lib/gooby_io.rb', line 14

def write_lines(out_name, lines)
  s = ''
  lines.each { | line | 
    s << line
    s << "\n"
  }
  write_file(out_name, s)
end