diff options
-rw-r--r-- | app/models/censor_rule.rb | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/app/models/censor_rule.rb b/app/models/censor_rule.rb index b346917ec..eda4e23af 100644 --- a/app/models/censor_rule.rb +++ b/app/models/censor_rule.rb @@ -64,13 +64,11 @@ class CensorRule < ActiveRecord::Base def apply_to_text!(text) return nil if text.nil? - to_replace = regexp? ? make_regexp : self.text text.gsub!(to_replace, replacement) end def apply_to_binary!(binary) return nil if binary.nil? - to_replace = regexp? ? make_regexp : text binary.gsub!(to_replace) { |match| match.gsub(/./, 'x') } end @@ -84,4 +82,10 @@ class CensorRule < ActiveRecord::Base info_request_id.nil? && user_id.nil? && public_body_id.nil? end + private + + def to_replace + regexp? ? make_regexp : text + end + end |