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

scala.build.options.MaybeScalaVersion.scala Maven / Gradle / Ivy

There is a newer version: 1.5.1
Show newest version
package scala.build.options

final case class MaybeScalaVersion(versionOpt: Option[String] = None) {
  def asString = versionOpt.getOrElse(MaybeScalaVersion.noneStr)
}

object MaybeScalaVersion {

  private def noneStr = "none"

  def none: MaybeScalaVersion =
    MaybeScalaVersion(noneStr)

  def apply(s: String): MaybeScalaVersion =
    if (s == noneStr) MaybeScalaVersion(None)
    else MaybeScalaVersion(Some(s))

  implicit lazy val hashedType: HashedType[MaybeScalaVersion] = { v =>
    HashedType.string.hashedValue(v.versionOpt.getOrElse("no-scala-version"))
  }
  implicit lazy val hasHashData: HasHashData[MaybeScalaVersion] =
    HasHashData.derive
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy