Class: QuartzTorrent::Words
- Inherits:
-
Object
- Object
- QuartzTorrent::Words
- Defined in:
- lib/quartz_flow/mock_client.rb
Instance Method Summary collapse
-
#initialize ⇒ Words
constructor
A new instance of Words.
- #randomWord ⇒ Object
Constructor Details
#initialize ⇒ Words
Returns a new instance of Words.
11 12 13 14 15 16 17 18 |
# File 'lib/quartz_flow/mock_client.rb', line 11 def initialize @words = [] File.open "/usr/share/dict/words", "r" do |file| file.each_line do |l| @words.push l.chomp end end end |
Instance Method Details
#randomWord ⇒ Object
20 21 22 |
# File 'lib/quartz_flow/mock_client.rb', line 20 def randomWord @words[rand(@words.size)] end |