------ art_45274_18978418.1172690391880 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline On 2/28/07, Raj Sahae <rajsahae / gmail.com> wrote: Well, I'm new to ruby too, but the most obvious things I would do is > loop the gets so that you don't write everything twice, and make a > method to handle the gets so that you don't write that 10 times. As far > as making it more "rubyish", I'm sure I would mess that up, but I guess, > with that in mind, I would at least put it in a class, and I personally > like using string interpolation, it's more readable for me. > > Raj > > #ResumeBuilder.rb > > class ResumeBuilder > def initialize > puts("Welcome to ResumeBuilder v.1") > correct " > until correct.downcase "yes" > @first_name rompt_and_get("first name").chomp.capitalize > @last_name rompt_and_get("last name").chomp.capitalize > @full_name #{@first_name} #{@last_name}" > puts("You have entered #{@full_name} as your name. > Is this correct? (yes/no)") > correct ets.chomp > end > correct " > until correct.downcase "yes" > @street_number rompt_and_get("street number").chomp > @street_name rompt_and_get("street name").chomp.capitalize > @city_name rompt_and_get("city name").chomp.capitalize > @state_name rompt_and_get("state").chomp.upcase > @zip_code rompt_and_get("zip code").chomp > puts "You have told me that you live at: > #{@street_number} #{@street_name} > #{@city_name}, #{@state_name} #{@zip_code} > Is this correct? (yes/no)" > correct ets.chomp > end > end > > def prompt_and_get(string) > puts "Please enter your #{string}: " > gets > end > end > > ResumeBuilder.new > > Thanks for the answer, Raj. I think that this is going to be a good way for me to learn and improve! -- Samantha http://www.babygeek.org/ "Beware when the great God lets loose a thinker on this planet. Then all things are at risk." --Ralph Waldo Emerson ------ art_45274_18978418.1172690391880--