All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.scalatra.RouteMatcher.scala Maven / Gradle / Ivy

package org.scalatra

import ScalatraKernel.MultiParams

object RouteMatcher {
  def matchRoute(routeMatchers: Iterable[RouteMatcher]) = {
    routeMatchers.foldLeft(Option(Map[String, Seq[String]]())) { (acc: Option[MultiParams], rm: RouteMatcher) =>
      for (x <- acc; y <- rm.apply()) yield x ++ y           
    }
  }

  implicit def fun2RouteMatcher(f: () => Option[MultiParams]) = new RouteMatcher { def apply() = f() }
}

trait RouteMatcher extends (() => Option[MultiParams]) 




© 2015 - 2025 Weber Informatics LLC | Privacy Policy