Thanks Jesus and Robert for your responses. > You can even modularize it more by adding a method that will do the > parsing and output a complete initialized CourseController. > #initialize then might have an empty argument list or a different > list. Of course I am speculating a bit here since I do not know your > application case's details. To be more specific with you: In my program, I'm getting data from an HTML file row by row. Each row has 20 columns, and each of those columns makes up one variable in the Course class. I'm using an HTML/CSS/XML parser known as "Nokogiri". In CourseController, I have 4 methods for parsing the HTML: def count_rows # Returns total number of rows (by counting how many <tr> tags there are) end def get_row(row) # Returns an array of 20 elements, each being a column from the specified row # This is mainly focused around the code: @doc.css("tr:nth-child(#{row}) .dddefault").each { temp.push(e) } return temp end def collect_courses # Returns an array of arrays of courses. E.g.: [[course1,data,data], [course2,data,data], etc...] # (Works by using total row count (@row) and the get_row method for each course) return all_courses end def get_courses # Returns an array of Course instances, where each instance is a unique course. all_courses = collect_courses all_courses.each { |i| temp.push(i) } returns temp end In the CourseController constructor, my code is as follows: def initialize(url) @doc = Nokogiri::HTML(open(url)) @row = count_rows @courses = get_courses end How in this case do I improve my code to use the self.read_file and self.read_url methods? I can't entirely see how this would work, and what would change. And are this many methods acceptable for parsing the HTML or is it better if I merge them to make one, clean method? -- Derek -- Posted via http://www.ruby-forum.com/.