sanitize-rails 0.5.0 → 0.6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/README.md +3 -1
  2. data/lib/sanitize/rails.rb +11 -9
  3. metadata +2 -2
data/README.md CHANGED
@@ -4,7 +4,9 @@ Sanitize-Rails - sanitize .. on Rails.
4
4
  Installation
5
5
  ------------
6
6
 
7
- gem install sanitize-rails
7
+ Gemfile:
8
+
9
+ gem 'sanitize-rails', :require => 'sanitize/rails'
8
10
 
9
11
  Configuration
10
12
  -------------
@@ -4,7 +4,7 @@ require 'sanitize'
4
4
  require 'sanitize/railtie' if defined? Rails
5
5
 
6
6
  module Sanitize::Rails
7
- Version = '0.5.0'
7
+ Version = '0.6.0'
8
8
 
9
9
  # Configures the sanitizer with the given `config` hash.
10
10
  #
@@ -38,13 +38,13 @@ module Sanitize::Rails
38
38
  # Returns a copy of the given `string` after sanitizing it
39
39
  #
40
40
  def clean(string)
41
- string.dup.tap {|s| clean!(s)} unless string.blank?
41
+ clean!(string.dup)
42
42
  end
43
43
 
44
- # Sanitizes the given string in place, forcing UTF-8 encoding on it.
44
+ # Sanitizes the given `string` in place
45
45
  #
46
46
  def clean!(string)
47
- cleaner.clean!(string) unless string.blank?
47
+ cleaner.clean!(string)
48
48
  end
49
49
 
50
50
  def callback_for(options) #:nodoc:
@@ -97,11 +97,13 @@ module Sanitize::Rails
97
97
  callback = Engine.callback_for(options)
98
98
  sanitizer = Engine.method_for(fields)
99
99
 
100
- define_method(sanitizer) do # def sanitize_fieldA_fieldB
101
- fields.each do |field| # # Unrolled version
102
- sanitized = Engine.clean(send(field)) # self.fieldA = Engine.clean(self.fieldA)
103
- send("#{field}=", sanitized) # self.fieldB = Engine.clean(self.fieldB)
104
- end # # For clarity :-)
100
+ define_method(sanitizer) do # # Unrolled version
101
+ fields.each do |field| #
102
+ unless field.blank? # def sanitize_fieldA_fieldB
103
+ sanitized = Engine.clean(send(field)) # self.fieldA = Engine.clean(self.fieldA) unless fieldA.blank?
104
+ send("#{field}=", sanitized) # self.fieldB = Engine.clean(self.fieldB) unless fieldB.blank?
105
+ end # end
106
+ end #
105
107
  end # end
106
108
 
107
109
  protected sanitizer # protected :sanitize_fieldA_fieldB
metadata CHANGED
@@ -4,9 +4,9 @@ version: !ruby/object:Gem::Version
4
4
  prerelease: false
5
5
  segments:
6
6
  - 0
7
- - 5
7
+ - 6
8
8
  - 0
9
- version: 0.5.0
9
+ version: 0.6.0
10
10
  platform: ruby
11
11
  authors:
12
12
  - Marcello Barnaba