Class: PhotoFlick::Dictionary
- Inherits:
-
Object
- Object
- PhotoFlick::Dictionary
- Defined in:
- lib/photo_flick/dictionary.rb
Overview
This class responsible for providing random words from a dictionary
Instance Method Summary collapse
- #get_random_words(count) ⇒ Object
-
#initialize ⇒ Dictionary
constructor
A new instance of Dictionary.
Constructor Details
#initialize ⇒ Dictionary
Returns a new instance of Dictionary.
6 7 8 9 |
# File 'lib/photo_flick/dictionary.rb', line 6 def initialize path = File.('../../../data', __FILE__) @file = File.read("#{path}/words") end |
Instance Method Details
#get_random_words(count) ⇒ Object
11 12 13 |
# File 'lib/photo_flick/dictionary.rb', line 11 def get_random_words(count) @file.split("\n").sample(count) end |