diff options
author | Christopher Vogt <oss.nsp@cvogt.org> | 2017-02-26 21:47:01 +0800 |
---|---|---|
committer | Christopher Vogt <oss.nsp@cvogt.org> | 2017-02-27 12:27:44 +0800 |
commit | 3ab41fcbfc26f972b6e55f0c9f9b443cc699e0f1 (patch) | |
tree | 0b8e48ea205b26817c3006bc234def6e7be4b24a /stage2/Lib.scala | |
parent | d023e0cf778f472af71b5ada5aa9d0f97cd5bf8b (diff) | |
download | cbt-3ab41fcbfc26f972b6e55f0c9f9b443cc699e0f1.tar.gz cbt-3ab41fcbfc26f972b6e55f0c9f9b443cc699e0f1.tar.bz2 cbt-3ab41fcbfc26f972b6e55f0c9f9b443cc699e0f1.zip |
call no args .apply methods of referenced objects
this effectively lets users execute no arg functions from the cmd line via cbt
Diffstat (limited to 'stage2/Lib.scala')
-rw-r--r-- | stage2/Lib.scala | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/stage2/Lib.scala b/stage2/Lib.scala index 0f912e9..07f2cf6 100644 --- a/stage2/Lib.scala +++ b/stage2/Lib.scala @@ -214,7 +214,15 @@ final class Lib(val logger: Logger) extends Stage1Lib(logger){ } } }.getOrElse{ - ( Some(obj), None, None ) + ( + Some( + obj.getClass.getMethods.find(m => m.getName == "apply" && m.getParameterCount == 0).map( + _.invoke(obj) + ).getOrElse( obj ) + ), + None, + None + ) } } |