diff options
author | Jesse Luehrs <doy@tozt.net> | 2013-02-14 12:54:58 -0600 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2013-02-14 17:42:11 -0600 |
commit | ee54a6bcf88208d01af0cb6501304f68f647c467 (patch) | |
tree | c287002d9256ee1057e1642cbc3187621c996936 | |
parent | b1b55f620a72a13ffd02b6e76f92d97a1a82748c (diff) | |
download | scala-path-router-ee54a6bcf88208d01af0cb6501304f68f647c467.tar.gz scala-path-router-ee54a6bcf88208d01af0cb6501304f68f647c467.zip |
clean up Route a bit
-rw-r--r-- | src/main/scala/router.scala | 16 |
1 files changed, 4 insertions, 12 deletions
diff --git a/src/main/scala/router.scala b/src/main/scala/router.scala index fbbd052..eece34d 100644 --- a/src/main/scala/router.scala +++ b/src/main/scala/router.scala @@ -95,19 +95,11 @@ class Route[T] ( private lazy val components = path.split("/").filter(_.length > 0) - private lazy val length = - components.length + lazy val requiredVariableComponents = + components.filter(!isOptional(_)).flatMap(getComponentName) - private lazy val lengthWithoutOptionals = - components.filter(!isOptional(_)).length - - private lazy val requiredVariableComponentNames = - for (c <- components if isVariable(c) && !isOptional(c)) - yield getComponentName(c) - - private lazy val optionalVariableComponentNames = - for (c <- components if isVariable(c) && isOptional(c)) - yield getComponentName(c) + lazy val optionalVariableComponents = + components.filter(isOptional).flatMap(getComponentName) private val Optional = """^\?:(.*)$""".r private val Variable = """^\??:(.*)$""".r |