Path: | lib/will_paginate/array.rb |
Last Update: | Tue Feb 10 22:17:26 +0000 2009 |
# File lib/will_paginate/array.rb, line 5 5: def paginate(options = {}) 6: raise ArgumentError, "parameter hash expected (got #{options.inspect})" unless Hash === options 7: 8: WillPaginate::Collection.create( 9: options[:page] || 1, 10: options[:per_page] || 30, 11: options[:total_entries] || self.length 12: ) { |pager| 13: pager.replace self[pager.offset, pager.per_page].to_a 14: } 15: end