lib/angelo/mustermann.rb in angelo-0.1.8 vs lib/angelo/mustermann.rb in angelo-0.1.9

- old
+ new

@@ -45,15 +45,23 @@ def params @params ||= super.merge mustermann.params(request.path) end - class RouteMap < Hash + class RouteMap + + def initialize + @hash = Hash.new + end + + def []= route, responder + @hash[route] = responder + end + def [] route responder = nil - mustermann = keys.select {|k| k.match(route)}.first - if mustermann - responder = fetch mustermann + if mustermann = @hash.keys.select {|k| k.match(route)}.first + responder = @hash.fetch mustermann responder.mustermann = mustermann end responder end end