<% require 'cgi' require 'Badguy.rb' #requires you to write a Badguy class in Badguy.rb cgi = CGI.new # will keep track of our badguys baddyArray = [] # grabs information passed to Battwitter to add a new Badguy to Battwitter if(cgi.has_key?("name") and cgi.has_key?("crime") and cgi.has_key?("rank")) name = cgi['name'] crime = cgi['crime'] rank = cgi['rank'] battweet = Badguy.new(name, crime, rank) battweet.write_to_file("baddies.txt") # YOU WILL NEED TO IMPLEMENT THIS METHOD end # file processing to handle creating Badguys from baddies.txt File.open("baddies.txt") do |input| while line = input.gets newBaddy = Badguy.new newBaddy.from_s(line) # YOU WILL NEED TO IMPLEMENT THIS METHOD baddyArray.push(newBaddy) end end %>
Who dunn'it:

What were they up to?:
Priority:
<% (baddyArray.length - 1).downto(0) do |i| cur_baddy = baddyArray[i] # YOU WILL NEED TO IMPLEMENT ACCESS TO THESE INSTANCE VARIABLES %>
<%= cur_baddy.name %> : <%= cur_baddy.crime %>
Priority: <%= cur_baddy.rank %>
<% end %>