cells 4.0.3 → 4.0.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: 4bee10d6791664dd2d5b07e42007b4f037d977ce
4
- data.tar.gz: badeb19dd989fcb7e04ff0ba194392858ad654ed
3
+ metadata.gz: 0deae1307acc8178812fdb8770ef8e42fa1ec62e
4
+ data.tar.gz: 1ace8b75ed910b9a1e870d9b3c9bececbe81295a
5
5
  SHA512:
6
- metadata.gz: 455f05a45cf95840609675ed94044f541d0111c0b1d5c0dd2d2cf13516405d8dd666df7d7fa3280fd927fd59711395bf09a7e8b829f515519caa5fef3968f2a5
7
- data.tar.gz: 40e74042491c83aefb0ac2a929ca5ed2c0037b489eb27beef1329415730dcd2815ae4dba413c3c74086f56872a952c410f178f995816c767d5d84e4146325a1c
6
+ metadata.gz: 32622f1999e6bebefff207da8c68c367b3e80e958449bd84f5ac5b5712c27358af6b591387c2e9dbeade5fdb50368083aff80bb7be0851813c9a3a6d6f5653b5
7
+ data.tar.gz: f4604cb8d50ae093e94ef9ce9a2747573945750e68d2d3f2fe4d6936574e546c748023c32b7d2daa9f05bab5617d0818327be2b438d1384ac01d4ee942f2b086
data/CHANGES.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## 4.0.4
2
+
3
+ * `Escaped::property` now properly escapes all passed properties. Thanks @xzo and @jlogsdon!
4
+
1
5
  ## 4.0.3
2
6
 
3
7
  * `Cell::Partial` now does _append_ the global partial path to its `view_paths` instead of using `unshift` and thereby removing possible custom paths.
@@ -4,14 +4,16 @@ module Cell::ViewModel::Escaped
4
4
  end
5
5
 
6
6
  module Property
7
- def property(name, *args)
7
+ def property(*names)
8
8
  super.tap do # super defines #title
9
9
  mod = Module.new do
10
- define_method(name) do |options={}|
11
- value = super() # call the original #title.
12
- return value unless value.is_a?(String)
13
- return value if options[:escape] == false
14
- escape!(value)
10
+ names.each do |name|
11
+ define_method(name) do |options={}|
12
+ value = super() # call the original #title.
13
+ return value unless value.is_a?(String)
14
+ return value if options[:escape] == false
15
+ escape!(value)
16
+ end
15
17
  end
16
18
  end
17
19
  include mod
@@ -24,4 +26,4 @@ module Cell::ViewModel::Escaped
24
26
  def escape!(string)
25
27
  ::ERB::Util.html_escape(string)
26
28
  end
27
- end
29
+ end
@@ -1,3 +1,3 @@
1
1
  module Cell
2
- VERSION = "4.0.3"
2
+ VERSION = "4.0.4"
3
3
  end
@@ -20,6 +20,7 @@ class EscapedPropertyTest < MiniTest::Spec
20
20
  include Escaped
21
21
  property :title
22
22
  property :artist
23
+ property :copyright, :lyrics
23
24
 
24
25
  def title(*)
25
26
  "#{super}</b>" # super + "</b>" still escapes, but this is Rails.
@@ -30,12 +31,18 @@ class EscapedPropertyTest < MiniTest::Spec
30
31
  end
31
32
  end
32
33
 
33
- let (:song) { Struct.new(:title, :artist).new("<b>She Sells And Sand Sandwiches", Object) }
34
+ let (:song) do
35
+ Struct
36
+ .new(:title, :artist, :copyright, :lyrics)
37
+ .new("<b>She Sells And Sand Sandwiches", Object, "<a>Copy</a>", "<i>Words</i>")
38
+ end
34
39
 
35
40
  # ::property escapes, everywhere.
36
41
  it { SongCell.(song).title.must_equal "&lt;b&gt;She Sells And Sand Sandwiches</b>" }
42
+ it { SongCell.(song).copyright.must_equal "&lt;a&gt;Copy&lt;/a&gt;" }
43
+ it { SongCell.(song).lyrics.must_equal "&lt;i&gt;Words&lt;/i&gt;" }
37
44
  # no escaping for non-strings.
38
45
  it { SongCell.(song).artist.must_equal Object }
39
46
  # no escaping when escape: false
40
47
  it { SongCell.(song).raw_title.must_equal "<b>She Sells And Sand Sandwiches</b>" }
41
- end
48
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cells
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.0.3
4
+ version: 4.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nick Sutterer
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-12-01 00:00:00.000000000 Z
11
+ date: 2016-01-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: uber