Created
January 21, 2010 02:40
-
-
Save slyphon/282526 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/ruby | |
class SayMahName | |
def initialize | |
@wordlist = File.readlines("/usr/share/dict/web2").map {|n| n.chomp } | |
end | |
def say_some_random_stuff | |
an_array = [] | |
10.times do | |
an_array << random_word | |
end | |
say(an_array.join(' ')) | |
end | |
def random_word | |
@wordlist[rand(@wordlist.length)] | |
end | |
def say(words) | |
puts "i'm about to say '#{words}' out loud" | |
system("say '#{words}'") | |
end | |
end | |
smn = SayMahName.new | |
smn.say_some_random_stuff | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment