Created
March 4, 2017 02:10
-
-
Save minosiants/1072c55dddd04ce96452c2ae0d1b9903 to your computer and use it in GitHub Desktop.
Evaluating string as scala code using twitter util-eval
This file contains 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
// https://github.com/twitter/util | |
object Programm extends App { | |
import com.twitter.util.Eval | |
type EntryConditionFunc = Map[String, String] => Boolean | |
val eval = new Eval | |
val func = eval[EntryConditionFunc]("""(ctx:Map[String, String]) => ctx("name") == "hello" """) | |
val result = func(Map("name" -> "hello")) | |
println(result) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment