diff options
author | Christopher Vogt <oss.nsp@cvogt.org> | 2017-03-17 03:39:38 -0400 |
---|---|---|
committer | Christopher Vogt <oss.nsp@cvogt.org> | 2017-03-17 03:41:37 -0400 |
commit | 9dbe839f074a8ed69f1e2853f7d40c21a9db407f (patch) | |
tree | 5952d28f083535d5b0b2bd86fbef81881061d8b4 /stage1 | |
parent | 94500b34aef7744c7063bccfbeb4f0e2ebd76a26 (diff) | |
download | cbt-9dbe839f074a8ed69f1e2853f7d40c21a9db407f.tar.gz cbt-9dbe839f074a8ed69f1e2853f7d40c21a9db407f.tar.bz2 cbt-9dbe839f074a8ed69f1e2853f7d40c21a9db407f.zip |
add boolean to option helper
Diffstat (limited to 'stage1')
-rw-r--r-- | stage1/cbt.scala | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/stage1/cbt.scala b/stage1/cbt.scala index 5f8f2b5..b97ad44 100644 --- a/stage1/cbt.scala +++ b/stage1/cbt.scala @@ -20,6 +20,9 @@ object `package`{ private val lib = new BaseLib + implicit class CbtBooleanExtensions(condition: Boolean){ + def option[T](value: =>T): Option[T] = if(condition) Some(value) else None + } implicit class CbtStringExtensions(string: String){ def escape = string.replace("\\","\\\\").replace("\"","\\\"") def quote = s""""$escape"""" |