Skip to content

Instantly share code, notes, and snippets.

@trane
Created December 14, 2016 22:27
Show Gist options
  • Save trane/a355f17907575bfd7bd25141e553aca8 to your computer and use it in GitHub Desktop.
Save trane/a355f17907575bfd7bd25141e553aca8 to your computer and use it in GitHub Desktop.
trait Prepare {
val id: PrepareId
}
case class Preparing(id: PrepareId) extends Prepare
case class Prepared(id: PrepareId, paths: Seq[Path]) extends Prepare
object Prepare {
def pathStrings(prepare: Prepare): Seq[String] = prepare match {
case Preparing(_) => Seq.empty[String]
case Prepared(_, paths) => paths.map(_.toAbsolutePath.toString)
}
implicit class PrepareOps(val prepare: Prepare) {
def pathStrings: Seq[String] = Prepare.pathStrings(prepare)
}
}
repositoryService.prepared(id).pathString
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment