'Add a new route or replace the target for an existing route.'

def add(self, rule, method, target, name=None):

    if (rule in self.routes):
        self.routes[rule][method.upper()] = target
    else:
        self.routes[rule] = {method.upper(): target}
        self.rules.append(rule)
        if (self.static or self.dynamic):
            (self.static, self.dynamic) = ({}, {})
    if name:
        self.named[name] = (rule, None)
