Created
March 12, 2013 09:53
-
-
Save joa/5141649 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
implicit class Iif[T](val x: T) extends AnyVal { def iif(cond: => Boolean): Option[T] = if(cond) Some(x) else None } | |
"yey" iif true == true getOrElse "ney" //yey | |
"yey" iif true != true getOrElse "ney" //ney | |
val file = "index.html" iif req.uri == "/" getOrElse req.uri |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment