Skip to content

Commit

Permalink
Rename method
Browse files Browse the repository at this point in the history
  • Loading branch information
lloydmeta committed Feb 20, 2015
1 parent 54b7d44 commit d35f501
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/main/scala/com/beachape/play/Csv.scala
Expand Up @@ -55,7 +55,7 @@ object Csv {
bound <- implicitly[QueryStringBindable[A]].bind(key, Map(key -> Seq(unescapeCsv(trim(rawValue)))))
} yield bound
}
Some(toEitherCsvOrElse(s"Failed to bind all of ${params.get(key)}")(tryBinds))
Some(transformOrElse(s"Failed to bind all of ${params.get(key)}")(tryBinds))
}
}

Expand All @@ -75,7 +75,7 @@ object Csv {

def bind(key: String, value: String): Either[String, Csv[A]] = {
val tryBinds = Try { split(value, ',').toSeq map (raw => implicitly[PathBindable[A]].bind(key, unescapeCsv(trim(raw)))) }
toEitherCsvOrElse(s"Could not bind $value into a Csv")(tryBinds)
transformOrElse(s"Could not bind $value into a Csv")(tryBinds)
}

def unbind(key: String, value: Csv[A]): String = {
Expand All @@ -97,7 +97,7 @@ object Csv {
}
tryEitherSeqEitherBinds match {
case Success(Right(seqEitherBinds)) if seqEitherBinds.forall(_.isRight) => {
toEitherCsvOrElse(Seq(FormError(key, "Could not bind Csv", Nil)))(Success(seqEitherBinds))
transformOrElse(Seq(FormError(key, "Could not bind Csv", Nil)))(Success(seqEitherBinds))
}
case _ => Left(Seq(FormError(key, "Could not bind Csv", Nil)))
}
Expand All @@ -113,7 +113,7 @@ object Csv {
}

// The orElse comes first so we can let the compiler infer types
private[this] def toEitherCsvOrElse[A, B](orElse: => A)(tryBinds: Try[Seq[Either[A, B]]]): Either[A, Csv[B]] = {
private[this] def transformOrElse[A, B](orElse: => A)(tryBinds: Try[Seq[Either[A, B]]]): Either[A, Csv[B]] = {
tryBinds match {
case Success(seqEithers) if seqEithers.forall(_.isRight) => {
val seq = for {
Expand Down

0 comments on commit d35f501

Please sign in to comment.