diff options
author | Jesse Luehrs <doy@tozt.net> | 2013-02-15 12:35:45 -0600 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2013-02-15 12:35:45 -0600 |
commit | c7a6a865e2159a37fa5b57d0795d6a43f7c8d78b (patch) | |
tree | d78b0b23f66edad36acfc67cf9e362555a805159 /src | |
parent | 575ef538743cb2c1929b5df54c99ce7800f7e3b3 (diff) | |
download | scala-path-router-c7a6a865e2159a37fa5b57d0795d6a43f7c8d78b.tar.gz scala-path-router-c7a6a865e2159a37fa5b57d0795d6a43f7c8d78b.zip |
insertRoute is not particularly useful
Diffstat (limited to 'src')
-rw-r--r-- | src/main/scala/router.scala | 13 | ||||
-rw-r--r-- | src/test/scala/basic.scala | 25 |
2 files changed, 12 insertions, 26 deletions
diff --git a/src/main/scala/router.scala b/src/main/scala/router.scala index 3b15ca8..7f60dec 100644 --- a/src/main/scala/router.scala +++ b/src/main/scala/router.scala @@ -13,19 +13,6 @@ class Router[T] { routes += new Route(path, defaults, validations, target) } - def insertRoute ( - path: String, - target: T, - defaults: Map[String, String] = Map(), - validations: Map[String, Regex] = Map(), - at: Int = 0 - ) { - routes insert ( - at min routes.length, - new Route(path, defaults, validations, target) - ) - } - def route (path: String): Option[Match[T]] = { def testRoutes ( components: Seq[String], diff --git a/src/test/scala/basic.scala b/src/test/scala/basic.scala index 71aa370..bf22361 100644 --- a/src/test/scala/basic.scala +++ b/src/test/scala/basic.scala @@ -8,6 +8,16 @@ class Basic extends FunSuite { val dayRx = """\d|[12]\d|30|31""".r val router = new Router[Boolean] + + router addRoute ( + "blog", + true, + defaults = Map( + "controller" -> "blog", + "action" -> "index" + ) + ) + router addRoute ( "blog/:year/:month/:day", true, @@ -22,19 +32,9 @@ class Basic extends FunSuite { ) ) - router insertRoute ( - "blog", - true, - defaults = Map( - "controller" -> "blog", - "action" -> "index" - ) - ) - - router insertRoute ( + router addRoute ( "blog/:action/:id", true, - at = 2, defaults = Map( "controller" -> "blog" ), @@ -44,10 +44,9 @@ class Basic extends FunSuite { ) ) - router insertRoute ( + router addRoute ( "test/?:x/?:y", true, - at = 1000000, defaults = Map( "controller" -> "test", "x" -> "x", |