Class: ActionView::CollectionRenderer::CollectionIterator

Inherits:
Object
  • Object
show all
Includes:
Enumerable
Defined in:
actionview/lib/action_view/renderer/collection_renderer.rb

Overview

:nodoc:

Instance Method Summary collapse

Methods included from Enumerable

#as_json

Constructor Details

#initialize(collection) ⇒ CollectionIterator

Returns a new instance of CollectionIterator.



39
40
41
# File 'actionview/lib/action_view/renderer/collection_renderer.rb', line 39

def initialize(collection)
  @collection = collection
end

Instance Method Details

#each(&blk) ⇒ Object



43
44
45
# File 'actionview/lib/action_view/renderer/collection_renderer.rb', line 43

def each(&blk)
  @collection.each(&blk)
end

#lengthObject



51
52
53
# File 'actionview/lib/action_view/renderer/collection_renderer.rb', line 51

def length
  @collection.respond_to?(:length) ? @collection.length : size
end

#preload!Object



55
56
57
# File 'actionview/lib/action_view/renderer/collection_renderer.rb', line 55

def preload!
  # no-op
end

#sizeObject



47
48
49
# File 'actionview/lib/action_view/renderer/collection_renderer.rb', line 47

def size
  @collection.size
end