Sha256: 21888998924d2040f107f571f74502c6810f6366ee714c4ce4c84392b12d1d45
Contents?: true
Size: 1013 Bytes
Versions: 3
Compression:
Stored size: 1013 Bytes
Contents
# frozen_string_literal: true module Blocks class CollectionRenderer def self.render(runtime_context) collection = runtime_context.collection if collection original_collection_item = runtime_context.collection_item original_collection_item_index = runtime_context.collection_item_index original_runtime_args = runtime_context.runtime_args collection.each_with_index do |item, index| runtime_context.collection_item = item runtime_context.collection_item_index = index if Blocks.collection_item_passed_to_block_as_first_arg runtime_context.runtime_args = [item, *original_runtime_args] end yield runtime_context end runtime_context.collection_item = original_collection_item runtime_context.collection_item_index = original_collection_item_index runtime_context.runtime_args = original_runtime_args else yield runtime_context end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
blocks-4.0.1 | lib/blocks/renderers/collection_renderer.rb |
blocks-4.0.0 | lib/blocks/renderers/collection_renderer.rb |
blocks-4.0.0.rc2 | lib/blocks/renderers/collection_renderer.rb |