Class: Files

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

Instance Method Summary collapse

Instance Method Details

#read_file(plain_text_file) ⇒ Object



2
3
4
5
6
7
8
# File 'lib/enigma/files.rb', line 2

def read_file(plain_text_file)
  text = ""
  File.open(plain_text_file).each do |line|
    text << line
  end
  text
end

#write_file(encrypted_file, encrypted_text) ⇒ Object



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

def write_file(encrypted_file, encrypted_text)
  File.open(encrypted_file, "w") { |f| f.write(encrypted_text) }
end