blocks 0.4 → 0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -56,7 +56,7 @@
56
56
 
57
57
  <%= table.define :data_columns do |options| %>
58
58
  <% table.columns.each do |column| %>
59
- <%= content_tag :td, options.merge(column.options)[:data_html] do %>
59
+ <%= content_tag :td, options.merge(column.options)[:column_html] do %>
60
60
  <%= table.use column, options.merge(:column => column) %>
61
61
  <% end %>
62
62
  <% end %>
@@ -8,7 +8,7 @@ module Blocks
8
8
  def method_missing(m, options={}, &block)
9
9
  # If the specified block group has already been defined, it is simply returned here for iteration.
10
10
  # It will consist of all the blocks used in this block group that have yet to be rendered,
11
- # as the call for their use occurred before the template was rendered
11
+ # as the call for their use occurred before the template was rendered (where their definitions likely occurred)
12
12
  return self.block_groups[m] unless self.block_groups[m].nil?
13
13
 
14
14
  # Allows for nested block groups, store the current block positions array and start a new one
@@ -65,6 +65,7 @@ module Blocks
65
65
  block_container.block = block
66
66
 
67
67
  blocks[name.to_sym] = block_container if blocks[name.to_sym].nil?
68
+
68
69
  nil
69
70
  end
70
71
 
@@ -88,6 +89,8 @@ module Blocks
88
89
  # Delays rendering this block until the partial has been rendered and all the blocks have had a chance to be defined
89
90
  self.block_positions << block_container
90
91
  end
92
+
93
+ nil
91
94
  end
92
95
 
93
96
  def render
@@ -133,61 +136,55 @@ module Blocks
133
136
  name = name_or_container.to_sym
134
137
  end
135
138
 
136
- ret = render_before_blocks(name, options)
139
+ view.concat(render_before_blocks(name, options))
137
140
 
138
141
  if blocks[name]
139
142
  block_container = blocks[name]
140
- ret.concat(view.capture shared_options.merge(block_container.options).merge(render_options), &block_container.block)
143
+ view.concat(view.capture shared_options.merge(block_container.options).merge(render_options), &block_container.block)
141
144
  elsif view.blocks.blocks[name]
142
145
  block_container = view.blocks.blocks[name]
143
- ret.concat(view.capture shared_options.merge(block_container.options).merge(render_options), &block_container.block)
146
+ view.concat(view.capture shared_options.merge(block_container.options).merge(render_options), &block_container.block)
144
147
  else
145
148
  begin
146
- ret.concat(view.render "#{shared_options[:templates_folder]}/#{name.to_s}", shared_options.merge(render_options))
149
+ view.concat(view.render "#{shared_options[:templates_folder]}/#{name.to_s}", shared_options.merge(render_options))
147
150
  rescue
148
151
 
149
152
  end
150
153
  end
151
154
 
152
- ret.concat(render_after_blocks(name, options))
155
+ view.concat(render_after_blocks(name, options))
153
156
  end
154
157
 
155
158
  def render_before_blocks(name, options={})
156
159
  name = "before_#{name.to_s}".to_sym
157
160
 
158
- ret = ActionView::NonConcattingString.new
159
161
  unless blocks[name].nil?
160
162
  blocks[name].each do |block_container|
161
- ret.concat(view.capture shared_options.merge(block_container.options).merge(options), &block_container.block)
163
+ view.concat(view.capture shared_options.merge(block_container.options).merge(options), &block_container.block)
162
164
  end
163
165
  end
164
166
 
165
167
  unless view.blocks.blocks[name].nil?
166
168
  view.blocks.blocks[name].each do |block_container|
167
- ret.concat(view.capture shared_options.merge(block_container.options).merge(options), &block_container.block)
169
+ view.concat(view.capture shared_options.merge(block_container.options).merge(options), &block_container.block)
168
170
  end
169
171
  end
170
-
171
- ret
172
172
  end
173
173
 
174
174
  def render_after_blocks(name, options={})
175
175
  name = "after_#{name.to_s}".to_sym
176
176
 
177
- ret = ActionView::NonConcattingString.new
178
177
  unless blocks[name].nil?
179
178
  blocks[name].each do |block_container|
180
- ret.concat(view.capture shared_options.merge(block_container.options).merge(options), &block_container.block)
179
+ view.concat(view.capture shared_options.merge(block_container.options).merge(options), &block_container.block)
181
180
  end
182
181
  end
183
182
 
184
183
  unless view.blocks.blocks[name].nil?
185
184
  view.blocks.blocks[name].each do |block_container|
186
- ret.concat(view.capture shared_options.merge(block_container.options).merge(options), &block_container.block)
185
+ view.concat(view.capture shared_options.merge(block_container.options).merge(options), &block_container.block)
187
186
  end
188
187
  end
189
-
190
- ret
191
188
  end
192
189
  end
193
190
  end
metadata CHANGED
@@ -1,12 +1,12 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: blocks
3
3
  version: !ruby/object:Gem::Version
4
- hash: 3
4
+ hash: 1
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
- - 4
9
- version: "0.4"
8
+ - 5
9
+ version: "0.5"
10
10
  platform: ruby
11
11
  authors:
12
12
  - Andrew Hunter