cells 4.1.6 → 4.1.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGES.md +4 -0
- data/README.md +6 -0
- data/lib/cell/collection.rb +3 -3
- data/lib/cell/version.rb +1 -1
- data/test/context_test.rb +2 -2
- data/test/public_test.rb +7 -0
- data/test/templates_test.rb +2 -2
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6adc87ec8eca9078c65bcea669da31e439e2836d
|
4
|
+
data.tar.gz: 2c6bcc96311731ac78165e54cdae3aba3d080cf4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 95b6c7639b08804f21fd234e8eb88ff7c915bac16b797d430c0f8ce3c8eb16832edfd59582b91521b29b87ac9e210764a52c592cf94e9dedf9f0c6818ae2386e
|
7
|
+
data.tar.gz: d3b72099ec39ef4db0e18059a9af9d570902daa6bd2c4023593afae3fa46a8a60e33e2bf4361f38d73d94e9cd7d6cbefd52b374e0ad7f7ab5917ee7abac8c262
|
data/CHANGES.md
CHANGED
data/README.md
CHANGED
@@ -36,6 +36,12 @@ This boils down to the following invocation, that can be used to render cells in
|
|
36
36
|
CommentCell.(@comment).()
|
37
37
|
```
|
38
38
|
|
39
|
+
You can also pass the cell class in explicitly:
|
40
|
+
|
41
|
+
```ruby
|
42
|
+
<%= cell(CommentCell, @comment) %>
|
43
|
+
```
|
44
|
+
|
39
45
|
In Rails you have the same helper API for views and controllers.
|
40
46
|
|
41
47
|
```ruby
|
data/lib/cell/collection.rb
CHANGED
@@ -31,9 +31,9 @@ module Cell
|
|
31
31
|
# Its return value is captured and joined.
|
32
32
|
def join(separator="", &block)
|
33
33
|
@ary.each_with_index.collect do |model, i|
|
34
|
-
|
35
|
-
|
36
|
-
|
34
|
+
cell = @cell_class.build(model, @options)
|
35
|
+
block_given? ? yield(cell, i) : cell
|
36
|
+
end.join(separator)
|
37
37
|
end
|
38
38
|
|
39
39
|
module Layout
|
data/lib/cell/version.rb
CHANGED
data/test/context_test.rb
CHANGED
@@ -34,9 +34,9 @@ class ContextTest < MiniTest::Spec
|
|
34
34
|
it do
|
35
35
|
child = parent.cell(ParentCell, nil, context: { "is_child?" => true })
|
36
36
|
|
37
|
-
parent.context["is_child?"]
|
37
|
+
assert_nil(parent.context["is_child?"])
|
38
38
|
|
39
|
-
child.model
|
39
|
+
assert_nil(child.model)
|
40
40
|
child.controller.must_equal controller
|
41
41
|
child.user.must_equal user
|
42
42
|
child.context["is_child?"].must_equal true
|
data/test/public_test.rb
CHANGED
@@ -89,4 +89,11 @@ class PublicTest < MiniTest::Spec
|
|
89
89
|
i == 1 ? cell.(:detail) : cell.()
|
90
90
|
end.must_equal '[Object, {}]>* [Module, {}]'
|
91
91
|
end
|
92
|
+
|
93
|
+
# 'join' can be used without a block:
|
94
|
+
it do
|
95
|
+
Cell::ViewModel.cell(
|
96
|
+
"public_test/song", collection: [Object, Module]
|
97
|
+
).join('---').must_equal('[Object, {}]---[Module, {}]')
|
98
|
+
end
|
92
99
|
end
|
data/test/templates_test.rb
CHANGED
@@ -8,7 +8,7 @@ class TemplatesTest < MiniTest::Spec
|
|
8
8
|
it { Templates.new[['test/fixtures/bassist'], 'play.erb', {template_class: Cell::Erb::Template}].file.must_equal 'test/fixtures/bassist/play.erb' }
|
9
9
|
|
10
10
|
# not existing.
|
11
|
-
it { Templates.new[['test/fixtures/bassist'], 'not-here.erb', {}]
|
11
|
+
it { assert_nil(Templates.new[['test/fixtures/bassist'], 'not-here.erb', {}]) }
|
12
12
|
|
13
13
|
|
14
14
|
# different caches for different classes
|
@@ -41,4 +41,4 @@ class TemplatesCachingTest < MiniTest::Spec
|
|
41
41
|
# cached, NO new tilt template.
|
42
42
|
cell.call(:show).must_equal 'The Great Mind Eraser'
|
43
43
|
end
|
44
|
-
end
|
44
|
+
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.1.
|
4
|
+
version: 4.1.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nick Sutterer
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-05-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: uber
|
@@ -218,7 +218,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
218
218
|
version: '0'
|
219
219
|
requirements: []
|
220
220
|
rubyforge_project:
|
221
|
-
rubygems_version: 2.
|
221
|
+
rubygems_version: 2.5.2
|
222
222
|
signing_key:
|
223
223
|
specification_version: 4
|
224
224
|
summary: View Models for Ruby and Rails.
|