aboutsummaryrefslogtreecommitdiffstats
path: root/app/models/censor_rule.rb
diff options
context:
space:
mode:
authorGareth Rees <gareth@mysociety.org>2014-10-10 17:35:42 +0100
committerGareth Rees <gareth@mysociety.org>2014-10-15 15:48:15 +0100
commit60523352e7760e9907fe35c8e9ce503cbfe8abc7 (patch)
tree79b31347c96260212c35848d2bba9b41c79b65b2 /app/models/censor_rule.rb
parente2d4bdb629997036c6ed72d7eb14b95dae6f76cb (diff)
Avoid use of parameter with attribute name
The `text` parameter in `apply_to_text!(text)` can easily be confused with the `text` attribute of a CensorRule. Renamed to avoid confusion and renamed the parameter in `apply_to_binary!` for consistency.
Diffstat (limited to 'app/models/censor_rule.rb')
-rw-r--r--app/models/censor_rule.rb12
1 files changed, 6 insertions, 6 deletions
diff --git a/app/models/censor_rule.rb b/app/models/censor_rule.rb
index 499896e54..3b5c2d805 100644
--- a/app/models/censor_rule.rb
+++ b/app/models/censor_rule.rb
@@ -42,14 +42,14 @@ class CensorRule < ActiveRecord::Base
:user_id => nil,
:public_body_id => nil } }
- def apply_to_text!(text)
- return nil if text.nil?
- text.gsub!(to_replace, replacement)
+ def apply_to_text!(text_to_censor)
+ return nil if text_to_censor.nil?
+ text_to_censor.gsub!(to_replace, replacement)
end
- def apply_to_binary!(binary)
- return nil if binary.nil?
- binary.gsub!(to_replace) { |match| match.gsub(/./, 'x') }
+ def apply_to_binary!(binary_to_censor)
+ return nil if binary_to_censor.nil?
+ binary_to_censor.gsub!(to_replace) { |match| match.gsub(/./, 'x') }
end
def for_admin_column