loofah 0.2.1 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of loofah might be problematic. Click here for more details.
- data.tar.gz.sig +4 -2
- data/CHANGELOG.rdoc +7 -0
- data/README.rdoc +1 -1
- data/lib/loofah.rb +1 -1
- data/lib/loofah/active_record.rb +4 -4
- data/lib/loofah/deprecated.rb +1 -1
- data/test/test_active_record.rb +4 -4
- metadata +2 -2
- metadata.gz.sig +0 -0
data.tar.gz.sig
CHANGED
@@ -1,2 +1,4 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
z�L&����3V���(y|5�+�k�7��<�Aae*<dIw���M�x�hLQ�F��1�מ�.naa���
|
2
|
+
K���� �@'��8�_j��ޗ ��w�!�٫���|�T�[[nd�
|
3
|
+
2�H��<YQ�Nl|U�Ap:�Z2���ZH����;V�L�H�و��q%R����n����c�feFO
|
4
|
+
s譸8p��AƇ���yƺS�ef����$���m��J�ǸvLೢN�j�gV:�����*G,�þ�
|
data/CHANGELOG.rdoc
CHANGED
data/README.rdoc
CHANGED
data/lib/loofah.rb
CHANGED
data/lib/loofah/active_record.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
module Loofah
|
2
2
|
#
|
3
|
-
# Loofah can scrub ActiveRecord attributes in a
|
3
|
+
# Loofah can scrub ActiveRecord attributes in a before_validation callback:
|
4
4
|
#
|
5
5
|
# # in environment.rb
|
6
6
|
# Rails::Initializer.run do |config|
|
@@ -15,7 +15,7 @@ module Loofah
|
|
15
15
|
#
|
16
16
|
# # app/model/post.rb
|
17
17
|
# class Post < ActiveRecord::Base
|
18
|
-
# html_fragment :body, :scrub => :prune # scrubs 'body' in a
|
18
|
+
# html_fragment :body, :scrub => :prune # scrubs 'body' in a before_validation
|
19
19
|
# end
|
20
20
|
#
|
21
21
|
module ActiveRecordExtension
|
@@ -25,7 +25,7 @@ module Loofah
|
|
25
25
|
#
|
26
26
|
def html_fragment(attr, options={})
|
27
27
|
raise ArgumentError, "html_fragment requires :scrub option" unless method = options[:scrub]
|
28
|
-
|
28
|
+
before_validation do |record|
|
29
29
|
record[attr] = Loofah.scrub_fragment(record[attr], method).to_s
|
30
30
|
end
|
31
31
|
end
|
@@ -36,7 +36,7 @@ module Loofah
|
|
36
36
|
#
|
37
37
|
def html_document(attr, options={})
|
38
38
|
raise ArgumentError, "html_document requires :scrub option" unless method = options[:scrub]
|
39
|
-
|
39
|
+
before_validation do |record|
|
40
40
|
record[attr] = Loofah.scrub_document(record[attr], method).to_s
|
41
41
|
end
|
42
42
|
end
|
data/lib/loofah/deprecated.rb
CHANGED
data/test/test_active_record.rb
CHANGED
@@ -25,11 +25,11 @@ class TestActiveRecord < Test::Unit::TestCase
|
|
25
25
|
should "scrub the specified field" do
|
26
26
|
Loofah.expects(:scrub_fragment).with(HTML_STRING, :prune).once
|
27
27
|
Loofah.expects(:scrub_fragment).with(PLAIN_TEXT, :prune).never
|
28
|
-
@post.
|
28
|
+
@post.valid?
|
29
29
|
end
|
30
30
|
|
31
31
|
should "generate strings" do
|
32
|
-
@post.
|
32
|
+
@post.valid?
|
33
33
|
assert_equal String, @post.html_string.class
|
34
34
|
assert_equal HTML_STRING, @post.html_string
|
35
35
|
end
|
@@ -44,11 +44,11 @@ class TestActiveRecord < Test::Unit::TestCase
|
|
44
44
|
should "scrub the specified field, but not other fields" do
|
45
45
|
Loofah.expects(:scrub_document).with(HTML_STRING, :strip).once
|
46
46
|
Loofah.expects(:scrub_document).with(PLAIN_TEXT, :strip).never
|
47
|
-
@post.
|
47
|
+
@post.valid?
|
48
48
|
end
|
49
49
|
|
50
50
|
should "generate strings" do
|
51
|
-
@post.
|
51
|
+
@post.valid?
|
52
52
|
assert_equal String, @post.html_string.class
|
53
53
|
end
|
54
54
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: loofah
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mike Dalessio
|
@@ -31,7 +31,7 @@ cert_chain:
|
|
31
31
|
FlqnTjy13J3nD30uxy9a1g==
|
32
32
|
-----END CERTIFICATE-----
|
33
33
|
|
34
|
-
date: 2009-08-
|
34
|
+
date: 2009-08-30 00:00:00 -04:00
|
35
35
|
default_executable:
|
36
36
|
dependencies:
|
37
37
|
- !ruby/object:Gem::Dependency
|
metadata.gz.sig
CHANGED
Binary file
|