Module: Spicy::Corpus

Included in:
Disk::Corpus, Memory::Corpus
Defined in:
lib/corpus.rb

Instance Method Summary collapse

Instance Method Details

#adjective(*args) ⇒ Object



3
4
5
# File 'lib/corpus.rb', line 3

def adjective(*args)
  generate(:adjectives, *args)
end

#adverb(*args) ⇒ Object



15
16
17
# File 'lib/corpus.rb', line 15

def adverb(*args)
  generate(:adverbs, *args)
end

#format(format) ⇒ Object



23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/corpus.rb', line 23

def format(format)
  format.gsub(/%([anbv%])/) do
    case $1
    when 'a'
      adjective
    when 'n'
      noun
    when 'b'
      adverb
    when 'v'
      verb
    when '%'
      '%'
    end
  end
end

#noun(*args) ⇒ Object



7
8
9
# File 'lib/corpus.rb', line 7

def noun(*args)
  generate(:nouns, *args)
end

#pair(separator = '-') ⇒ Object



19
20
21
# File 'lib/corpus.rb', line 19

def pair(separator = '-')
  "#{adjective}#{separator}#{noun}"
end

#verb(*args) ⇒ Object



11
12
13
# File 'lib/corpus.rb', line 11

def verb(*args)
  generate(:verbs, *args)
end