sanitized_attributes 1.1.1 → 1.2.1

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.1.1
1
+ 1.2.1
@@ -12,9 +12,16 @@ module SanitizedAttributes; class SanitizedAttribute
12
12
  def define_ar_writer_method(klass)
13
13
  this = self
14
14
  attr_name = @attr_name
15
- klass.send(:define_method, "#{@attr_name}=") {|value|
16
- send(:write_attribute, attr_name, this.sanitize(value))
17
- }
15
+ if klass.instance_methods.include?("#{@attr_name}=")
16
+ klass.send(:define_method, "#{@attr_name}_with_sanitization=") {|value|
17
+ send(:"#{@attr_name}_without_sanitization=", this.sanitize(value))
18
+ }
19
+ klass.send(:alias_method_chain, :"#{@attr_name}=", :sanitization)
20
+ else
21
+ klass.send(:define_method, "#{@attr_name}=") {|value|
22
+ send(:write_attribute, attr_name, this.sanitize(value))
23
+ }
24
+ end
18
25
  end
19
26
 
20
27
  def define_writer_method(klass)
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{sanitized_attributes}
8
- s.version = "1.1.1"
8
+ s.version = "1.2.1"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Matthew Boeh", "CrowdCompass, Inc."]
12
- s.date = %q{2011-01-27}
12
+ s.date = %q{2011-05-25}
13
13
  s.description = %q{A wrapper to make automatic sanitization of incoming data easier. Uses the sanitize gem and works in both plain Ruby and Rails projects.}
14
14
  s.email = %q{matthew.boeh@gmail.com}
15
15
  s.extra_rdoc_files = [
@@ -31,15 +31,10 @@ Gem::Specification.new do |s|
31
31
  ]
32
32
  s.homepage = %q{http://github.com/mboeh/sanitized_attributes}
33
33
  s.require_paths = ["lib"]
34
- s.rubygems_version = %q{1.3.7}
34
+ s.rubygems_version = %q{1.6.2}
35
35
  s.summary = %q{HTML-sanitizing attribute accessors for Ruby and Rails}
36
- s.test_files = [
37
- "spec/sanitized_attributes_spec.rb",
38
- "spec/spec_helper.rb"
39
- ]
40
36
 
41
37
  if s.respond_to? :specification_version then
42
- current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
43
38
  s.specification_version = 3
44
39
 
45
40
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sanitized_attributes
3
3
  version: !ruby/object:Gem::Version
4
- hash: 17
5
- prerelease: false
4
+ hash: 29
5
+ prerelease:
6
6
  segments:
7
7
  - 1
8
+ - 2
8
9
  - 1
9
- - 1
10
- version: 1.1.1
10
+ version: 1.2.1
11
11
  platform: ruby
12
12
  authors:
13
13
  - Matthew Boeh
@@ -16,7 +16,7 @@ autorequire:
16
16
  bindir: bin
17
17
  cert_chain: []
18
18
 
19
- date: 2011-01-27 00:00:00 -08:00
19
+ date: 2011-05-25 00:00:00 -07:00
20
20
  default_executable:
21
21
  dependencies:
22
22
  - !ruby/object:Gem::Dependency
@@ -100,10 +100,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
100
100
  requirements: []
101
101
 
102
102
  rubyforge_project:
103
- rubygems_version: 1.3.7
103
+ rubygems_version: 1.6.2
104
104
  signing_key:
105
105
  specification_version: 3
106
106
  summary: HTML-sanitizing attribute accessors for Ruby and Rails
107
- test_files:
108
- - spec/sanitized_attributes_spec.rb
109
- - spec/spec_helper.rb
107
+ test_files: []
108
+