Ruby - Functional Patterns in Ruby
You want to process a large file line by line without loading it all into memory. Which lazy enumerator method chain is best?
File.foreach reads file line by line lazily, ideal for large files.File.readlines reads entire file into memory; File.read reads whole file as string; File.open returns file object but needs iteration.15+ quiz questions · All difficulty levels · Free
Free Signup - Practice All Questions