
urldsl.vocabulary.Segment.scala Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of url-dsl_2.12 Show documentation
Show all versions of url-dsl_2.12 Show documentation
A tiny library for parsing and creating urls in a type-safe way
The newest version!
package urldsl.vocabulary
import scala.language.implicitConversions
/** A [[Segment]] is a simple wrapper around a specific String content between two `/`. */
final case class Segment(content: String) extends AnyVal {
def map(f: String => String): Segment = Segment(f(content))
}
object Segment {
implicit def simpleSegment[T](t: T)(implicit printer: Printer[T]): Segment = Segment(printer(t))
def fromPath(path: String): List[Segment] = path.dropWhile(_ == '/').split("/").toList.filter(_.nonEmpty).map(apply)
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy