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

skinny.micro.rl.UriFragment.scala Maven / Gradle / Ivy

The newest version!
// The MIT License (MIT) Copyright (c) 2011 Mojolly Ltd.
package skinny.micro.rl

object UriFragment {

  def apply(rawValue: String): UriFragment = {
    rawValue.blankOption.map(StringFragment(_)).getOrElse(EmptyFragment)
  }

}

trait UriFragment extends UriNode {

  type Value

  def rawValue: String

  def value: Value

  def normalize: UriFragment = this

  def apply() = value.toString

}

case object EmptyFragment extends UriFragment {

  val uriPart = ""

  val value = ""

  val rawValue = ""

  type Value = String

}

case class StringFragment(rawValue: String) extends UriFragment {

  def uriPart = value.blankOption map { "#" + _ } getOrElse ""

  val value = rawValue

  type Value = String
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy