each_page returns Enumerator unless block_given

This commit is contained in:
Akira Matsuda 2011-04-18 01:40:38 +09:00
parent 2cc02d89fa
commit f23655cc24
1 changed files with 2 additions and 0 deletions

View File

@ -25,6 +25,8 @@ module Kaminari
# enumerate each page providing PageProxy object as the block parameter
def each_page
return to_enum(:each_page) unless block_given?
1.upto(@options[:num_pages]) do |i|
yield PageProxy.new(@window_options.merge(@options), i, @last)
end