Sha256: 01bf4bdc1b6eaeee357b5acd5fcfd1740dcee10c72e86715589e89da4146bb38
Contents?: true
Size: 1.1 KB
Versions: 5
Compression:
Stored size: 1.1 KB
Contents
# encoding: utf-8 require "rango" # for helpers module Rango module UrlHelper # url(:login) def url(*args) raise NotImplementedError, "Your router or your router adapter doesn't support this method" end end Helpers.send(:include, UrlHelper) class Router @@routers ||= Hash.new def self.app @@app rescue raise "You have to assign your router application to Rango::Router.app\nFor example Rango::Router.app = Usher::Interface.for(:rack, &block)" end def self.app=(app) @@app = app end def self.router @@router rescue raise "You have to run Rango::Router.use(router_name) first!" end def self.router=(router) @@router = router end def self.implement(router, &block) @@routers[router] = block end def self.use(router) require_relative "router/adapters/#{router}" Rango.logger.debug("Using router #{router}") @@router = router end def self.set_rack_env(env) unless env["rango.router.params"] @@routers[self.router].call(env) end end end end
Version data entries
5 entries across 5 versions & 1 rubygems
Version | Path |
---|---|
rango-0.2.3 | lib/rango/router.rb |
rango-0.2.1 | lib/rango/router.rb |
rango-0.2.1.pre | lib/rango/router.rb |
rango-0.2 | lib/rango/router.rb |
rango-0.2.pre | lib/rango/router.rb |