lib/nyara/route.rb in nyara-0.1.pre.0 vs lib/nyara/route.rb in nyara-0.1.pre.1
- old
+ new
@@ -156,12 +156,10 @@
# Split the path into 2 parts: <br>
# a fixed prefix and a variable suffix
def analyse_path path
raise 'path must contain no new line' if path.index "\n"
raise 'path must start with /' unless path.start_with? '/'
- path = path.sub(/\/$/, '') if path != '/'
-
path.split(FORWARD_SPLIT, 2)
end
end
# class methods
@@ -238,15 +236,18 @@
Ext.clear_route
@controllers = []
end
def print_routes
- puts "all routes:"
+ puts "All routes:"
Nyara::Route.routes.each do |route|
- print (route.id || "").gsub("#", "").rjust(30), " "
+ cname = route.controller.to_s
+ cname.gsub!("Controller", "")
+ cname.downcase!
+ print "#{cname}#{route.id}".rjust(30), " "
print route.http_method_to_s.ljust(6), " "
- print route.path
- puts ""
+ print route.path_template
+ puts
end
end
# private