Highlights
A company often needs to retrieve documents on its hard drive based on those documents containing words or phrases. It thus needs a system that allows the user to enter the required phrase or word and to then find the document/s containing that phrase and to print them to screen.
1. Question 1 – Search in text(.txt) files (5 marks)
Create a Ruby program file named Phase2Q11234.rb (1234 should replace by your student ID) and add the program logic needed to perform the following tasks:
1. Request two user inputs in text form- a term (or a word or a phrase) and a folder path(or directory path) from the user through command prompt. For example, a user inputs word “Ruby” and “C:\ Documents\MP\S2 2020\BIT246 OOP RAD Ruby” folder to find Ruby word in all text files in this folder.
2. Search for user input term in all text documents (.txt) in the user given directory and sub-directories (user input directory). Use glob method – Write in comments in program why to use glob
3. Search the user input term with case-insensitive i.e. For user input = Ruby will return the list of file that contains the word with any combination of uppercase or lowercase character e.g. Ruby, ruby, rubY or rUby.
4. Output the list of names of the text files containing the user given term and portion of content of each text file. You can add information like total number of documents containing the user given word or total number of occurrences of the user given word in a specific text file.
5. Display the appropriate message/information, if there is no match found for the given term/word/phrase in all text documents in the given directory.
6. This phase does not require any fancy user interface. User input will be provided through command prompt.
7. Develop program in Ruby to implement above functionality by using classes, attributes, methods, objects, and constructor. (Sample class is given on Moodle – Phase 2 Plan.doc)
8. Add appropriate comments e.g. Name, Student ID, functionality of a variable, brief explanation of logic.
2. Question 2 – Search in text(.txt), MS Word (.doc and .docx) and PDF files (10 marks)
Create a Ruby program file named Phase2Q21234.rb (1234 should replace by your student ID) and add the program logic needed to perform the following tasks:
1. This phase extends Question 1 by adding the capacity to search user given term(or word or phrase) in Word and Pdf documents as well as text documents.
2. Ruby gems are required to implement Phase 2 (i.e. download from https://rubygems.org/, installing the gem, using ‘require’ in code and calling the appropriate method of the gem ). Hint: Read the related gem documentation to identify the parameters and output of different methods provided by the gem.
3. Use search_in_file gem. (https://rubygems.org/gems/search_in_file/versions/1.0.1). Install all development dependencies.
4. Add appropriate comments e.g. Name, Student ID, functionality of each variable, brief explanation of your program logic.
5. Please note, no or less marks will be awarded if program does not execute or does not display correct output.
This BIT246: IT Assignment has been solved by our IT Experts at My Uni Paper. Our Assignment Writing Experts are efficient to provide a fresh solution to this question. We are serving more than 10000+ Students in Australia, UK & US by helping them to score HD in their academics. Our Experts are well trained to follow all marking rubrics & referencing style.
Be it a used or new solution, the quality of the work submitted by our assignment experts remains unhampered. You may continue to expect the same or even better quality with the used and new assignment solution files respectively. There’s one thing to be noticed that you could choose one between the two and acquire an HD either way. You could choose a new assignment solution file to get yourself an exclusive, plagiarism (with free Turnitin file), expert quality assignment or order an old solution file that was considered worthy of the highest distinction.
© Copyright 2026 My Uni Papers – Student Hustle Made Hassle Free. All rights reserved.