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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b0cd2efb3cdf312f2c529647f9188b4e7e6639bd
4
- data.tar.gz: 756d7e0d6e612d62d8750fb152f0ddfb238f6e47
3
+ metadata.gz: 6adc87ec8eca9078c65bcea669da31e439e2836d
4
+ data.tar.gz: 2c6bcc96311731ac78165e54cdae3aba3d080cf4
5
5
  SHA512:
6
- metadata.gz: 7fd5589f420bf75a25d03fd8c9e986cc4566cfd332457b58213f07a7f21b29087d0224bfb79977ebaae003bd998ff086edec71552bafb8ebb58973f71a9bf4a8
7
- data.tar.gz: 00d6fab903c9a92c29fb8c0398185f663ee9f6bc6c0235d56816b11115bedda4d9f20eae629d6aded51b11a458ee0e83172f3950312abd8cbb3b937bd4ac32d2
6
+ metadata.gz: 95b6c7639b08804f21fd234e8eb88ff7c915bac16b797d430c0f8ce3c8eb16832edfd59582b91521b29b87ac9e210764a52c592cf94e9dedf9f0c6818ae2386e
7
+ data.tar.gz: d3b72099ec39ef4db0e18059a9af9d570902daa6bd2c4023593afae3fa46a8a60e33e2bf4361f38d73d94e9cd7d6cbefd52b374e0ad7f7ab5917ee7abac8c262
data/CHANGES.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## 4.1.7
2
+
3
+ * `Collection#join` can now be called without a block.
4
+
1
5
  ## 4.1.6
2
6
 
3
7
  * Use `Declarative::Option` and `Declarative::Builder` instead of `uber`'s. This allows removing the `uber` version restriction.
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
@@ -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
- yield @cell_class.build(model, @options), i
35
- end.
36
- join(separator)
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
@@ -1,3 +1,3 @@
1
1
  module Cell
2
- VERSION = "4.1.6"
2
+ VERSION = "4.1.7"
3
3
  end
@@ -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?"].must_equal nil
37
+ assert_nil(parent.context["is_child?"])
38
38
 
39
- child.model.must_equal nil
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
@@ -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
@@ -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', {}].must_equal nil }
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.6
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-01-28 00:00:00.000000000 Z
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.6.3
221
+ rubygems_version: 2.5.2
222
222
  signing_key:
223
223
  specification_version: 4
224
224
  summary: View Models for Ruby and Rails.