class FlickrCollage::Dictionary

Constants

DICT_FILE

Attributes

words[RW]

@return [Array] All words at dictionary file

Public Class Methods

new(opts = {}) click to toggle source
# File lib/FlickrCollage.rb, line 22
def initialize(opts = {})
  opts[:file] ||= DICT_FILE
  @words = File.read(opts[:file]).lines.select do |line|
    (4..9).cover?(line.strip.size)
  end
end

Public Instance Methods

get_word() click to toggle source

Get random word from Dictionary file

@return [String] random word

# File lib/FlickrCollage.rb, line 32
def get_word
  @words.sample.strip
end