Sha256: e43c6977fdf114c174e4351395af3341f465cd969ddb27e8e5b52ace79551f5f

Contents?: true

Size: 464 Bytes

Versions: 14

Compression:

Stored size: 464 Bytes

Contents

require 'will_paginate/collection'

# http://www.desimcadam.com/archives/8
Array.class_eval do
  def paginate(options = {})
    raise ArgumentError, "parameter hash expected (got #{options.inspect})" unless Hash === options

    WillPaginate::Collection.create(
        options[:page] || 1,
        options[:per_page] || 30,
        options[:total_entries] || self.length
    ) { |pager|
      pager.replace self[pager.offset, pager.per_page].to_a
    }
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
refinerycms-0.9.6.34 vendor/plugins/will_paginate/lib/will_paginate/array.rb
refinerycms-0.9.6.33 vendor/plugins/will_paginate/lib/will_paginate/array.rb
refinerycms-0.9.6.32 vendor/plugins/will_paginate/lib/will_paginate/array.rb
refinerycms-0.9.6.31 vendor/plugins/will_paginate/lib/will_paginate/array.rb
refinerycms-0.9.6.30 vendor/plugins/will_paginate/lib/will_paginate/array.rb
refinerycms-0.9.6.29 vendor/plugins/will_paginate/lib/will_paginate/array.rb
refinerycms-0.9.6.28 vendor/plugins/will_paginate/lib/will_paginate/array.rb
refinerycms-0.9.6.27 vendor/plugins/will_paginate/lib/will_paginate/array.rb
refinerycms-0.9.6.26 vendor/plugins/will_paginate/lib/will_paginate/array.rb
refinerycms-0.9.6.25 vendor/plugins/will_paginate/lib/will_paginate/array.rb
refinerycms-0.9.6.24 vendor/plugins/will_paginate/lib/will_paginate/array.rb
refinerycms-0.9.6.23 vendor/plugins/will_paginate/lib/will_paginate/array.rb
refinerycms-0.9.6.22 vendor/plugins/will_paginate/lib/will_paginate/array.rb
refinerycms-0.9.6.21 vendor/plugins/will_paginate/lib/will_paginate/array.rb