From ee54a6bcf88208d01af0cb6501304f68f647c467 Mon Sep 17 00:00:00 2001 From: Jesse Luehrs Date: Thu, 14 Feb 2013 12:54:58 -0600 Subject: clean up Route a bit --- src/main/scala/router.scala | 16 ++++------------ 1 file 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 -- cgit v1.2.3-54-g00ecf