Class: Pagoid::AdapterRouter

Inherits:
Object
  • Object
show all
Defined in:
lib/pagoid/adapter_router.rb

Instance Method Summary collapse

Instance Method Details

#routeObject

Raises:

  • (RouterError)


13
14
15
16
17
18
# File 'lib/pagoid/adapter_router.rb', line 13

def route
  chosen_adapter = configured || route_table.find { |routeable| useable? routeable }
  raise RouterError, "Could not find a suitable Pagoid Adapter" unless chosen_adapter
  load_dependencies chosen_adapter
  constantize(pagoided(chosen_adapter)).new pageable
end