Rubyize this : 6th edition

Oh, my… God.
What is this? First post in a century? What’s going on here Fleebie? Our beloved readers are going to stop respecting us, and for good reasons.
For those who care, I am not dead, I am not sick… I am just working like crazy on Azanka, the company I started with Dan recently.
Ok now it’s time for a brand new edition of Rubyize this. Let’s get the ball rolling. Hold on… I’m going to google images to get a picture of a ball rolling.
364421257_8cad73e64f.jpg
Hmm… I’m afraid this isn’t going to roll at all
Anyway, consider this :
I am an old and unhappy programmer from the late eighties and you secretly watch me coding the following lines :

class VotingSystem
  #Hello, I am Rodger the old and unhappy programmer. the variable nbrOfVotes is an array of 2 dimensions. The first dimension contains the number of votes for the answer "YES, IT SUCKS"... and the other dimension contain the number of votes for the answer "NO, IT DOESN'T SUCK". In the near future there will be other possible answers... but I don't care! I retire in 2 days!
  @@nbrOfVotes = Array.new
  #The users who sent their vote arrive in this very top secret method!! (I retire in 2 days!)
  def receiveAVote(theVote)
    if theVote == "YES, IT SUCKS"
     @@nbrOfVotes[0] = 0 if @@nbrOfVotes[0].nil?
     @@nbrOfVotes[0] = @@nbrOfVotes[0] + 1
    else
      if theVote == "NO, IT DOESN'T SUCK"
        @@nbrOfVotes[1] = 0 if @@nbrOfVotes[1].nil?
        @@nbrOfVotes[1] = @@nbrOfVotes[1] + 1
      else
          puts "THIS IS NOT A VALID ANSWER YOU MORON... btw i retire in 2 days!"
      end
    end
  end
  #This is the function that compile ALL the votes... I retire in 2 days!
  def compileAllTheVotes
    for i in (0..1)
      if i == 0
        @@nbrOfVotes[0] = 0 if @@nbrOfVotes[0].nil?
        puts "HERE IS THE NUMBER OF VOTES FOR 'YES IT SUCKS' : " + @@nbrOfVotes[0].to_s
      else
        if i == 1
          @@nbrOfVotes[1] = 0 if @@nbrOfVotes[1].nil?
          puts "HERE IS THE NUMBER OF VOTES FOR 'NO IT DOESN'T SUCKS' : " + @@nbrOfVotes[1].to_s
        end
     end
    end
  end
end

Bring the light to this man who retires in 2 days
Refactor this on RMC!

9 thoughts on “Rubyize this : 6th edition

Leave a Reply

Your email address will not be published. Required fields are marked *