Class: Blocks::CollectionRenderer
- Inherits:
-
AbstractRenderer
- Object
- AbstractRenderer
- Blocks::CollectionRenderer
- Defined in:
- lib/blocks/renderers/collection_renderer.rb
Constant Summary
Constants inherited from AbstractRenderer
Instance Attribute Summary
Attributes inherited from AbstractRenderer
Instance Method Summary collapse
Methods inherited from AbstractRenderer
Constructor Details
This class inherits a constructor from Blocks::AbstractRenderer
Instance Method Details
#render(runtime_context) ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 14 15 |
# File 'lib/blocks/renderers/collection_renderer.rb', line 3 def render(runtime_context) collection = runtime_context.collection if collection object_name = runtime_context.as || :object collection.each_with_index do |item, index| item_runtime_context = runtime_context.merge(object_name => item, current_index: index) item_runtime_context.runtime_args = [item] + item_runtime_context.runtime_args yield item_runtime_context end else yield runtime_context end end |