class Beryl::Routing::Router
Attributes
routes[R]
Public Class Methods
new()
click to toggle source
# File lib/beryl/routing/router.rb, line 8 def initialize @routes = [] draw end
Public Instance Methods
match(path)
click to toggle source
# File lib/beryl/routing/router.rb, line 13 def match(path) @routes.each do |route| matched = Beryl::Routing::Matcher.match(route[0], path) return [route[1], matched] if matched end [:not_found] end
Private Instance Methods
draw()
click to toggle source
# File lib/beryl/routing/router.rb, line 23 def draw eval(File.open(File.expand_path('./app/routes.rb')).read) end
route(path, route)
click to toggle source
# File lib/beryl/routing/router.rb, line 27 def route(path, route) @routes << [path, route] end