lib/glueckskeks.rb in glueckskeks-0.1.0 vs lib/glueckskeks.rb in glueckskeks-0.1.1
- old
+ new
@@ -14,18 +14,18 @@
def self.logger= new_logger
@logger = new_logger
end
- def self.generate
- @corpus = CorpusReader.read_corpus_files
- if @corpus&.empty?
+ def self.generate(corpus_dir='corpus', entry='base')
+ @corpus = CorpusReader.read_corpus_files(corpus_dir)
+ if @corpus && @corpus.empty?
STDERR.puts "Empty corpus, are any data files present in ./corpus ?"
exit 1
end
- if @corpus['base'].nil? || @corpus['base'].empty?
+ if @corpus[entry].nil? || @corpus[entry].empty?
STDERR.puts "Corpus does not contain a base (corpus/base.corpus) file, or it does not contain any patterns."
exit 2
end
- Templater.fill(@corpus['base'].sample, @corpus)
+ Templater.fill(@corpus[entry].sample, @corpus)
end
end