From 634bc67342c325c828c35c155bee32b487fe60e1 Mon Sep 17 00:00:00 2001 From: Rick Okin Date: Tue, 9 Aug 2005 02:28:37 +0000 Subject: [PATCH] More lenient parsing of blocked_ips.txt and spam_patterns.txt --- config/environments/production.rb | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/config/environments/production.rb b/config/environments/production.rb index 02d9dcb9..c02b9346 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -5,11 +5,15 @@ ActionController::Base.perform_caching = false spam_patterns_filename = RAILS_ROOT + '/config/spam_patterns.txt' if File.exists? spam_patterns_filename - SPAM_PATTERNS = File.readlines(spam_patterns_filename).select { |line| line != '' }.map { - |line| Regexp.new(line) } + SPAM_PATTERNS = File.readlines(spam_patterns_filename).delete_if { |line| line.strip.empty? }.map { + |line| Regexp.new(line.strip) } end blocked_ips_filename = RAILS_ROOT + '/config/blocked_ips.txt' if File.exists? blocked_ips_filename - BLOCKED_IPS = File.readlines(blocked_ips_filename).select { |line| line != '' } + BLOCKED_IPS = File.readlines(blocked_ips_filename).delete_if { |line| line.strip.empty? }.map { + |line| line.strip } end + +require 'breakpoint' +breakpoint \ No newline at end of file