Class: CleanWords::Random

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

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.fetch(size = nil, count = 1) ⇒ Object



5
6
7
# File 'lib/clean_words.rb', line 5

def self.fetch(size=nil, count=1)
  new(size, count).fetch
end

Instance Method Details

#fetch(size = nil, count = 1) ⇒ Object



9
10
11
12
13
# File 'lib/clean_words.rb', line 9

def fetch(size=nil, count=1)
  @size = size
  @count = count
  @count > 1 ? @count.times.map { get_word } : get_word
end