Class: ActionView::CollectionRenderer::SameCollectionIterator

Inherits:
CollectionIterator show all
Defined in:
actionview/lib/action_view/renderer/collection_renderer.rb

Overview

:nodoc:

Direct Known Subclasses

PreloadCollectionIterator

Instance Method Summary collapse

Methods inherited from CollectionIterator

#each, #length, #preload!, #size

Methods included from Enumerable

#as_json

Constructor Details

#initialize(collection, path, variables) ⇒ SameCollectionIterator

Returns a new instance of SameCollectionIterator.



61
62
63
64
65
# File 'actionview/lib/action_view/renderer/collection_renderer.rb', line 61

def initialize(collection, path, variables)
  super(collection)
  @path      = path
  @variables = variables
end

Instance Method Details

#each_with_infoObject



71
72
73
74
75
# File 'actionview/lib/action_view/renderer/collection_renderer.rb', line 71

def each_with_info
  return enum_for(:each_with_info) unless block_given?
  variables = [@path] + @variables
  @collection.each { |o| yield(o, variables) }
end

#from_collection(collection) ⇒ Object



67
68
69
# File 'actionview/lib/action_view/renderer/collection_renderer.rb', line 67

def from_collection(collection)
  self.class.new(collection, @path, @variables)
end