Class: Taxi
- Inherits:
-
Object
- Object
- Taxi
- Defined in:
- lib/taxi.rb
Instance Method Summary collapse
- #display_random_word ⇒ Object
-
#initialize ⇒ Taxi
constructor
A new instance of Taxi.
- #load_language_files ⇒ Object
Constructor Details
#initialize ⇒ Taxi
Returns a new instance of Taxi.
5 6 7 8 9 10 11 12 |
# File 'lib/taxi.rb', line 5 def initialize @words = Array.new load_language_files 100.times.each do display_random_word sleep(5) end end |
Instance Method Details
#display_random_word ⇒ Object
26 27 28 29 30 31 |
# File 'lib/taxi.rb', line 26 def display_random_word title = "Korean" = @words[Random.rand(@words.count)] Growl.notify { self.title = title; self. = ; self.sticky! } end |
#load_language_files ⇒ Object
15 16 17 18 19 20 21 22 23 24 |
# File 'lib/taxi.rb', line 15 def load_language_files dir = File.(File.dirname(__FILE__)) f = IO.readlines(dir + "/korean.txt") count = f.count for i in 0...count do @words << f[i] end return @words end |