lib/page_up/fragment.rb in page_up-0.0.6 vs lib/page_up/fragment.rb in page_up-0.0.7
- old
+ new
@@ -12,14 +12,15 @@
def [] range
until covers? range
next_page = page_for(range)
result = @callback.call next_page, @per_page
- result.each_with_index do |value, index|
+ @per_page.times do |index|
+ value = result[index]
@fragment[index + offset(next_page)] = value
end
end
- @fragment[range]
+ @fragment[range].compact
end
def use &block
@callback = block
end