Class: PhotoFlick::Dictionary

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

Overview

This class responsible for providing random words from a dictionary

Instance Method Summary collapse

Constructor Details

#initializeDictionary

Returns a new instance of Dictionary.



6
7
8
9
# File 'lib/photo_flick/dictionary.rb', line 6

def initialize
  path = File.expand_path('../../../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