Class: CSVWrite

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

Instance Method Summary collapse

Constructor Details

#initializeCSVWrite

Returns a new instance of CSVWrite.



6
7
8
# File 'lib/file_writer.rb', line 6

def initialize
  @path = '../data.csv'
end

Instance Method Details

#readObject



16
17
18
# File 'lib/file_writer.rb', line 16

def read
  CSV.read(@path)
end

#write(word) ⇒ Object



10
11
12
13
14
# File 'lib/file_writer.rb', line 10

def write(word)
  CSV.open(@path, 'a') do |csv|
    csv << [word]
  end
end