Class: Taxi

Inherits:
Object
  • Object
show all
Defined in:
lib/taxi.rb

Instance Method Summary collapse

Constructor Details

#initializeTaxi

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_wordObject



26
27
28
29
30
31
# File 'lib/taxi.rb', line 26

def display_random_word
  title = "Korean"
  message = @words[Random.rand(@words.count)]
  
  Growl.notify { self.title =  title; self.message = message; self.sticky! }
end

#load_language_filesObject



15
16
17
18
19
20
21
22
23
24
# File 'lib/taxi.rb', line 15

def load_language_files
  dir = File.expand_path(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