Class: Ramaze::Helper::Paginate::Paginator::DataMapperPager

Inherits:
ArrayPager
  • Object
show all
Defined in:
lib/ramaze/helper/paginate.rb

Overview

Wrapper for DataMapper::Collection to behave like the Sequel pagination. needs 'datamapper' (or 'dm-core' and 'dm-aggregates')

Instance Method Summary (collapse)

Methods inherited from ArrayPager

#current_page, #each, #first_page?, #last_page?, #next_page, #page_count, #prev_page

Constructor Details

- (DataMapperPager) initialize(*args)

Returns a new instance of DataMapperPager



295
296
297
298
299
300
301
302
# File 'lib/ramaze/helper/paginate.rb', line 295

def initialize(*args)
  unless defined?(DataMapper::Aggregates)
    Ramaze::Log.warn "paginate.rb: it is strongly " +
                     "recommended to require 'dm-aggregates'"
  end

  super
end

Instance Method Details

- (Boolean) empty?

Returns:

  • (Boolean)


308
309
310
# File 'lib/ramaze/helper/paginate.rb', line 308

def empty?
  size == 0
end

- (Object) size



304
305
306
# File 'lib/ramaze/helper/paginate.rb', line 304

def size
  @cached_size ||= @array.count
end