module Flickrage::Helpers::Dict

Public Instance Methods

sample_words(n = 1) click to toggle source
# File lib/flickrage/helpers.rb, line 20
def sample_words(n = 1)
  Flickrage.dict.sample(n).map(&:strip)
end
sample_words_strict(n = 1, except: []) click to toggle source
# File lib/flickrage/helpers.rb, line 24
def sample_words_strict(n = 1, except: [])
  return [] if Flickrage.dict.size < (n + except.size)
  Flickrage.dict
           .sample(n + except.size)
           .map(&:strip)
            .-(except)
           .first(n)
end