From 7578cb9adb72b8761731a819b0c92327ae99cd62 Mon Sep 17 00:00:00 2001 From: Gibheer Date: Tue, 27 Nov 2012 06:41:09 +0100 Subject: Revert "added the first set of documentation" This reverts commit 37a4a28deec224f7cd9a5a124e22258e868913e4. --- doc/Zero/Router.html | 333 --------------------------------------------------- 1 file changed, 333 deletions(-) delete mode 100644 doc/Zero/Router.html (limited to 'doc/Zero/Router.html') diff --git a/doc/Zero/Router.html b/doc/Zero/Router.html deleted file mode 100644 index 8f95463..0000000 --- a/doc/Zero/Router.html +++ /dev/null @@ -1,333 +0,0 @@ - - - - - - Class: Zero::Router - - — Documentation by YARD 0.8.3 - - - - - - - - - - - - - - - - - - - - - -

Class: Zero::Router - - - -

- -
- -
Inherits:
-
- Object - -
    -
  • Object
  • - - - -
- show all - -
- - - - - - - - - -
Defined in:
-
lib/zero/router.rb
- -
-
- - -

Constant Summary

- -
- -
VARIABLE_MATCH = -
-
- -

match for variables in routes

- - -
-
-
- - -
-
-
%r{:(\w+)[^/]?}
-
- -
VARIABLE_REGEX = -
-
- -

the replacement string to make it an regex

- - -
-
-
- - -
-
-
'(?<\1>.+?)'
-
- -
- - - - - - - - - -

- Instance Method Summary - (collapse) -

- - - - -
-

Constructor Details

- -
-

- - - (Router) initialize(routes) - - - - - -

-
- -

A new instance of Router

- - -
-
-
- - -
- - - - -
-
-
-
-8
-9
-10
-11
-12
-13
-14
-15
-
-
# File 'lib/zero/router.rb', line 8
-
-def initialize(routes)
-  @routes = {}
-  routes.each do |route, target|
-    @routes[
-      Regexp.new(
-        route.gsub(VARIABLE_MATCH, VARIABLE_REGEX) + '$')] = target
-  end
-end
-
-
-
- -
- - -
-

Instance Method Details

- - -
-

- - - (Object) call(env) - - - - - -

- - - - -
-
-
-
-17
-18
-19
-20
-21
-22
-23
-24
-25
-26
-27
-28
-29
-
-
# File 'lib/zero/router.rb', line 17
-
-def call(env)
-  request = Zero::Request.create(env)
-  @routes.each do |route, target|
-    match = route.match(request.path)
-    if match
-      match.names.each_index do |i|
-        request.update_param(match.names[i], match.captures[i])
-      end
-      return target.call(request.env)
-    end
-  end
-  [404, {'Content-Type' => 'text/html'}, ['Not found!']]
-end
-
-
-
- -
- -
- - - - - \ No newline at end of file -- cgit v1.2.3-70-g09d2