mm-sanitize 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/Rakefile +1 -1
  2. data/lib/mm-sanitize.rb +6 -6
  3. metadata +4 -4
data/Rakefile CHANGED
@@ -21,7 +21,7 @@ spec = Gem::Specification.new do |s|
21
21
 
22
22
  # Change these as appropriate
23
23
  s.name = "mm-sanitize"
24
- s.version = "0.1.2"
24
+ s.version = "0.1.3"
25
25
  s.summary = "Tiny plugin for MongoMapper to sanitize strings before validation."
26
26
  s.author = "Richard Livsey"
27
27
  s.email = "youremail@example.com"
data/lib/mm-sanitize.rb CHANGED
@@ -10,20 +10,20 @@ module MongoMapper
10
10
 
11
11
  module ClassMethods
12
12
  def sanitize(*keys)
13
+ unless defined?(sanitize_keys)
14
+ class_attribute :sanitize_keys
15
+ end
16
+
13
17
  options = keys.pop if keys.last.is_a?(Hash)
14
18
  options ||= {}
15
19
 
16
- @sanitize_keys ||= {}
20
+ self.sanitize_keys ||= {}
17
21
  keys.each do |key|
18
- @sanitize_keys[key] = options[:config]
22
+ self.sanitize_keys[key] = options[:config]
19
23
  end
20
24
 
21
25
  self.send(:before_validation, :sanitize_attributes)
22
26
  end
23
-
24
- class_eval do
25
- attr_reader :sanitize_keys
26
- end
27
27
  end
28
28
 
29
29
  module InstanceMethods
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mm-sanitize
3
3
  version: !ruby/object:Gem::Version
4
- hash: 31
4
+ hash: 29
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 2
10
- version: 0.1.2
9
+ - 3
10
+ version: 0.1.3
11
11
  platform: ruby
12
12
  authors:
13
13
  - Richard Livsey
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-02-25 00:00:00 +00:00
18
+ date: 2011-03-01 00:00:00 +00:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency