Sha256: 091a421a2ec2a893b3d6b80358bc69e49a3c317d033d7a3f02c7ecee780d2b14
Contents?: true
Size: 829 Bytes
Versions: 1
Compression:
Stored size: 829 Bytes
Contents
module Responders module PaginateResponder def respond paginate! if get? super end private def paginate! adapter = ::Responders::PaginateResponder.init(self) @resource = adapter.paginate! if adapter end class << self def register(adapter) adapters << adapter end def adapters @adpaters ||= ::Set.new end def init(responder) if responder.controller.respond_to?(:pagination_adapter_init) return responder.controller.pagination_adapter_init(responder) end adapter = find(responder) adapter.new(responder) if adapter end def find(responder) adapters.find do |adapter| adapter.suitable?(responder.resource, responder) end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
paginate-responder-2.0.0 | lib/responders/paginate_responder.rb |