Class: DataMapper::Paginator::Control
- Inherits:
-
Object
- Object
- DataMapper::Paginator::Control
- Defined in:
- lib/dm-paginator/control.rb
Class Method Summary collapse
Class Method Details
.factory(paginator, kind = nil, options = {}) ⇒ Sliding|Elastic|Jumping|All
Factory.
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/dm-paginator/control.rb', line 13 def self.factory paginator, kind = nil, = {} if !paginator.is_a?( Main ) raise ArgumentError, "paginator argument is not an instance of Main" end case kind.downcase! when "sliding" return DataMapper::Paginator::ControlHelper::Sliding.new paginator, when "elastic" return DataMapper::Paginator::ControlHelper::Elastic.new paginator, when "jumping" return DataMapper::Paginator::ControlHelper::Jumping.new paginator, when "all", kind.empty? return DataMapper::Paginator::ControlHelper::All.new paginator, end end |