lib/foxdear_ebooks/model.rb in foxdear_ebooks-3.1.7 vs lib/foxdear_ebooks/model.rb in foxdear_ebooks-3.1.8
- old
+ new
@@ -99,11 +99,11 @@
def initialize
@tokens = []
@banned_words_file ||= 'banned_words.txt'
- @banned_words ||= File.exists?(@banned_words_file) ? File.read(@banned_words_file).split : []
+ @banned_words ||= File.exists?(@banned_words_file) ? File.read(@banned_words_file).split("\n") : []
# Reverse lookup tiki by token, for faster generation
@tikis = {}
end
# Reverse lookup a token index from a token
@@ -123,10 +123,10 @@
# @param path [String]
def set_banned_words(path = 'banned_words.txt')
return if @banned_words_file == path
@banned_words_file = path
if File.exists?(@banned_words_file)
- @banned_words = File.read(@banned_words_file).split
+ @banned_words = File.read(@banned_words_file).split("\n")
log "Successfully loaded banned words list #{path}"
else
log "Error: Banned words list #{path} does not exist"
end
end