Building a File Searcher in Ruby
In this guide, you will learn how to implement a method that searches through a file to find all of the content related to a certain query that was passed through.
Guide Tasks
- Read Tutorial
- Complete the Exercise
Summary
Build a method that searches through a file to retrieve information.
Exercise Description
Define a method that can pass a query to a text file and return the lines that include the query.
Example Data
([ "Death Star: A Primer", "Death Star Potential Vulnerabilities", "Meeting to Discuss Death Star?", "Death Star Project Plans" ])
Real World Usage
It is great to understand how to implement this file-searcher method, because it makes it easier and faster to gain access to all content included in a specific query.