Skip to content

Instantly share code, notes, and snippets.

Created March 2, 2012 05:52
Show Gist options
  • Save anonymous/1956082 to your computer and use it in GitHub Desktop.
Save anonymous/1956082 to your computer and use it in GitHub Desktop.
It's a description
=begin
notes: I need to use readlines method....also I need to make a method that accepts user input or accepts a directory as an arg and maybe includes input validation to make sure that the directory includes "' '" or maybe easier include the single quotes in the method...
end
read_source_lines_from_file_to_a = File.read('C:\Users\demon002\text.txt').each_line.to_a
read_source_lines_from_file_to_a[5] = "test test inserted word test test"
File.open('C:\Users\demon002\text.txt', "w") do |inst|
inst.puts read_source_lines_from_file_to_a.to_s
end
File.read('C:\Users\demon002\text.txt')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment