Skip to content

Instantly share code, notes, and snippets.

@kenoir
Created October 4, 2012 20:09
Show Gist options
  • Save kenoir/3836099 to your computer and use it in GitHub Desktop.
Save kenoir/3836099 to your computer and use it in GitHub Desktop.
Tube Coding
module Insultatron
class InsultGenerator
def modifier
["stinky","loser","arsey","daily mail reading"]
end
def subject
["weasel","arse","masterchef contestant"]
end
def insult!
puts "You #{pick_one(modifier)} #{pick_one(subject)}!"
puts "Why don't you shove a #{pick_one(subject)} up your #{pick_one(subject)}"
end
def pick_one(word_array)
index = random_index(word_array.count) - 1
word_array[index]
end
private
def random_index(max)
index = (rand * max).round
end
end
def self.run!
insult_generator = InsultGenerator.new
insult_generator.insult!
end
end
Insultatron.run!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment