Advertisement
urbanslug

FileParser.rb

Oct 29th, 2013
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.40 KB | None | 0 0
  1. class FileParser
  2.  
  3. def find_line(file_name, line_number)
  4. current_file = open(filename)
  5. array_of_lines = []
  6. while current_line = current_file.gets
  7. array_of_lines << current_line
  8. end
  9. array_of_lines[line_number]
  10. ensure
  11. current_file.close if current_file
  12. end
  13. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement