class FlickrCollageTty::Dictionary
Attributes
dictionary_url[RW]
instance[RW]
data[R]
Public Class Methods
load(path = '/usr/share/dict/words')
click to toggle source
# File lib/flickr_collage_tty/dictionary.rb, line 5 def load(path = '/usr/share/dict/words') self.dictionary_url = path self.instance = new(path) end
new(path)
click to toggle source
# File lib/flickr_collage_tty/dictionary.rb, line 19 def initialize(path) @path = path @data = load end
Public Instance Methods
sample()
click to toggle source
# File lib/flickr_collage_tty/dictionary.rb, line 13 def sample data.sample end
Private Instance Methods
load()
click to toggle source
# File lib/flickr_collage_tty/dictionary.rb, line 24 def load return [] unless File.exist?(@path) File.readlines(@path).map(&:strip) end