cells-capture 0.0.2 → 0.0.3

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: 598f35bebadd21a31d8876a2e01c8a2a2a7b2dd1
4
- data.tar.gz: c437045fdb031bc2565b59e57e904a830d13a642
3
+ metadata.gz: b0fa3fcc31aeaa1b18cb043e30491be8af3a6c09
4
+ data.tar.gz: 824ab2446fe7f936c1ad85a600827c49e8a76ae7
5
5
  SHA512:
6
- metadata.gz: bdd59c6c3083164bb50bfa6cb1570b9351ef0ec282639e438180af8aa2754a9473cc78ae9a16f639f53566e3ac781400cd5251cf7d87208597f3ea78595942ce
7
- data.tar.gz: 09e5f76ef16e305296666c549d2db825a7ad78fb9cb7fca80f7f05bd5ebe4b86e084194aa43c2341e494fd507e693b9f63dd7bf2ee35a736d54a7c99abefb377
6
+ metadata.gz: 198f0693e35f01e555584d6213c1f2918daae56ed3933ccdab1347ac8dab7483176ac5c89e96a14bd59c02c3a7658e06e2ec35d2f13a004713f3534f0a96c7c9
7
+ data.tar.gz: c7e27f6a4ea647b5ea8756378bb6f6b95d75e355581c9337bf85d79bc5b1f9043e3ffeef7e535fc0761149ef83a097e6d6aacca01b2438d41be1c6f215127fb9
data/README.md CHANGED
@@ -30,6 +30,4 @@ The captured content is now available globally (brrr) in your controller views o
30
30
 
31
31
  # Limitations
32
32
 
33
- Currently, if you passed a block to `#render_cell` in your view this won't work anymore.
34
-
35
- Also, I want to note that I am not a big fan of breaking cells' encapsulation by emiting content into a global variable. However, as many people asked for it I provide this feature to improve the world's happiness factor.
33
+ I want to note that I am not a big fan of breaking cells' encapsulation by emitting content into a global variable. However, as many people asked for it I provide this feature to improve the world's happiness factor.
@@ -11,8 +11,9 @@ module Cell
11
11
  attr_accessor :global_tpl
12
12
 
13
13
  module RenderCellExtension
14
- def render_cell(*args)
15
- super(*args) do |cell| # FIXME: block gets lost.
14
+ def render_cell(*args, &block)
15
+ super(*args) do |cell|
16
+ block.call(cell) if block_given?
16
17
  cell.global_tpl = self if cell.is_a? ::Cell::Rails::Capture
17
18
  end
18
19
  end
@@ -1,3 +1,7 @@
1
- ## 0.0.2
1
+ # 0.0.3
2
+
3
+ * Allow using `#render_cell` with block. Thanks to Kamil Jopek.
4
+
5
+ # 0.0.2
2
6
 
3
7
  * Fix a bug where `render_cell` would explode when rendering cells that don't include `Capture` support.
@@ -1,3 +1,3 @@
1
1
  module CellsCapture
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
@@ -16,7 +16,7 @@ end
16
16
 
17
17
  class BassistCell < Cell::Rails
18
18
  append_view_path("test/views")
19
-
19
+ attr_accessor :data_from_block
20
20
  #helper ::Cells::Helpers::CaptureHelper
21
21
  def content_for
22
22
  render
@@ -31,6 +31,11 @@ class CaptureTest < ActionController::TestCase
31
31
 
32
32
  test "#content_for" do
33
33
  get 'show'
34
- assert_equal "\n\n\nkeep me!<pre>DummDooDiiDoo</pre>", @response.body
34
+ assert_includes @response.body, "keep me!<pre>DummDooDiiDoo</pre>"
35
+ end
36
+
37
+ test "#render_cell passes arguments to the cell" do
38
+ get 'show'
39
+ assert_includes @response.body, "I am data from block"
35
40
  end
36
41
  end
@@ -4,4 +4,5 @@ don't show me.
4
4
  <% content_for :recorded do %>DummDoo<% end %>
5
5
  <% content_for :recorded do %>DiiDoo<% end %>
6
6
  <% content_for :recorded do %><% end %>
7
+ <%= controller.data_from_block %>
7
8
  keep me!
@@ -1 +1 @@
1
- <%= render_cell(:bassist, :content_for) %><pre><%= yield :recorded %></pre>
1
+ <%= render_cell(:bassist, :content_for) { |c| c.data_from_block = "I am data from block"} %><pre><%= yield :recorded %></pre>
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cells-capture
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nick Sutterer
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-01-06 00:00:00.000000000 Z
11
+ date: 2014-08-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -117,7 +117,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
117
117
  version: '0'
118
118
  requirements: []
119
119
  rubyforge_project:
120
- rubygems_version: 2.0.3
120
+ rubygems_version: 2.2.2
121
121
  signing_key:
122
122
  specification_version: 4
123
123
  summary: Provides content_for for Cells.