Skip to content

Instantly share code, notes, and snippets.

@slyphon
Created January 21, 2010 02:40
Show Gist options
  • Save slyphon/282526 to your computer and use it in GitHub Desktop.
Save slyphon/282526 to your computer and use it in GitHub Desktop.
#!/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