简体   繁体   中英

puppet like dsl in ruby

I'm implementing an internal DSL using ruby. I provide a command line tool to execute DSL scripts written in files (much like puppet ). At first I was going to use load() to run the scripts, thing is, I want to be able to pass some context before I execute the script. I was hoping I could read a script in text form and treat it as a block and then have that block executed with some given context. Is something like this possible?

Or how are such things generally achieved? It can be done for sure because puppet does it. But before I can dig through its code base, I'm trying here.

Also, are there any nice small examples of internal DSL implementations I could look at?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM