sanitize_rich_text 0.1.3 → 0.1.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a5261076fc451b8938120cb7c8891058944a8900
4
- data.tar.gz: 980e35688d8241810b2920e0eae98e201c8a0c92
3
+ metadata.gz: c8b861f3ceb942ed880d06a41a5f747f9e01612a
4
+ data.tar.gz: fef1bc5c0047b1ce95b55e2bd8838eb257398161
5
5
  SHA512:
6
- metadata.gz: bd9afaa43262244fa74ef23d883b274895a55d481f98feb437d4eb88e2105592a0744cd9f5e11a341a71ed426dfec4bc384af33348ef1af20e9738eff2346eb6
7
- data.tar.gz: f4db2c98417650c363fbd400fc370412d3b5555dc0cf1143f704f72590566bd5131bf411c629a292b38c9e47e552b38fd27c4f2637c020d6c54e88aef129809f
6
+ metadata.gz: 3989a52509a6facc10fa5ddd40ddf39f6c9bf7adc9b9f3eb6eba9a81ce024b27309eb3311bfdb211046e497cb0f6929c7e60da414f0e0aa867dfd55fc1312d41
7
+ data.tar.gz: 6f8a206fa39d639e4875eaed4dc87f9080ac8c9e12a6958475cc8d2c832c47d276d01c70c00acf972d6f4f803a458f0e51f0a7602a306d90b406d5c59bd1340f
@@ -8,25 +8,17 @@ module SanitizeRichText
8
8
  class_methods do
9
9
  def sanitize_rich_text(attr_name, options = {})
10
10
  define_method("#{attr_name}=") do |value|
11
+ html_elements = ['a', 'strong', 'b', 'br', 'em', 'sub', 'sup', 'ul', 'ol', 'li', 'p', 'u']
12
+ html_attributes = { 'a' => ['href', 'target'] }
11
13
  super(
12
14
  Sanitize.fragment(
13
15
  value,
14
- elements: options.fetch(:elements, nil) || elements,
15
- attributes: options.fetch(:attributes, nil) || attributes,
16
+ elements: options.fetch(:elements, nil) || html_elements,
17
+ attributes: options.fetch(:attributes, nil) || html_attributes,
16
18
  )
17
19
  )
18
20
  end
19
21
  end
20
22
  end
21
-
22
- protected
23
-
24
- def elements
25
- ['a', 'strong', 'b', 'br', 'em', 'sub', 'sup', 'ul', 'ol', 'li', 'p', 'u']
26
- end
27
-
28
- def attributes
29
- { 'a' => ['href', 'target'] }
30
- end
31
23
  end
32
24
  end
@@ -1,3 +1,3 @@
1
1
  module SanitizeRichText
2
- VERSION = "0.1.3"
2
+ VERSION = "0.1.4"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sanitize_rich_text
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Komposable