====== Ruby Exercises ====== * Deadline: Mon, Apr 28 * Use the Ruby Exercises dropbox on ecampus. Don't dropbox any input or output files. * **NOTE:** __Unless otherwise noted__, all work listed here is mandatory and counts toward your assignments grade. * **NOTE 2:** You must insert your name, id and program description in a comment block at the top of each program or else you will lose points. ---- ===== Exercise 1 - MU News html scraping with regular expressions ===== (a reprise of [[cs498gpl/python_exercises#exercise_5_-_html_parsing_with_re | Python Exercise 5]]) In ''rubyex1.rb'', parse the article titles and links from the HTML source of http://www.monmouth.edu/news/archives. Store the titles and links in arrays. Use regular expressions for this version. Later, we'll use [[http://ruby.bastardsbook.com/chapters/html-parsing/|a parser]]. **Note**: Also, dropbox ''rubyex1_map.rb'' and ''rubyex1_parser.rb''. ---- ===== Exercise 2 - A Roster class ===== In ''rubyex2.rb'' create and use a Roster class. The Roster class consists of an array of Student class objects (Student class shown below): class Student def initialize( first, last, email ) @first = first @last = last @email = email end def show puts "#{@first} #{@last} #{@email}" end end Create a new Roster called ''cs001'' that consists of the students in your [[https://piazza.com/class_profile/get_resource/m65min8nryeil/m6v65najj9234t|roster.txt]] file. Write a ''Roster.list'' method to show the roster of students. ---- ===== Exercise 3 - Ruby and SQLite3 ===== See the menu-driven Ruby/SQLite3 example program that allows you to create, manipulate and search a database table: * [[https://piazza.com/class_profile/get_resource/m65min8nryeil/m97ztlqww4f6cd|rbdb2.rb]] Save it as rubyex3.rb. Add a list_all function and corresponding "4) List all records" menu item to list all existing records in the database. ---- ===== Exercise 4 - Ruby on Rails mydiary sample app ===== Complete the //mydiary// [[cs498gpl/sample_ruby_on_rails_app_-_mydiary|Ruby on Rails mydiary sample app]]. Your app must contain the additions and changes that were made in class. **//Add at least three entries in your mydiary app. All entries must contain your name and student ID//**. After you are done, create a zip archive of the //mydiary// folder and dropbox it. ----