Class: DataMapper::Paginator::ControlHelper::All

Inherits:
Object
  • Object
show all
Includes:
DataMapper::Paginator::ControlHelperAbstract
Defined in:
lib/dm-paginator/control/all.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from DataMapper::Paginator::ControlHelperAbstract

#normalize_page_number, #pages_in_range

Constructor Details

#initialize(paginator, options = {}) ⇒ All

Returns a new instance of All.



9
10
11
12
13
14
15
16
# File 'lib/dm-paginator/control/all.rb', line 9

def initialize paginator, options = {}
  if !paginator.is_a?( Main )
    raise ArgumentError, "paginator argument is not an instance of Main"
  end

  @paginator = paginator
  @options = options
end

Instance Attribute Details

#optionsObject (readonly)

Returns the value of attribute options.



7
8
9
# File 'lib/dm-paginator/control/all.rb', line 7

def options
  @options
end

#paginatorObject (readonly)

Returns the value of attribute paginator.



7
8
9
# File 'lib/dm-paginator/control/all.rb', line 7

def paginator
  @paginator
end

Instance Method Details

#pages(page_range = nil) ⇒ Object



18
19
20
21
# File 'lib/dm-paginator/control/all.rb', line 18

def pages page_range = nil
  return unless paginator.page_count > 0
  return pages_in_range 1, paginator.count
end