Ruby DSL (Domain Specific Language) repositories, examples

前端 未结 6 2257
长情又很酷
长情又很酷 2020-12-14 09:40

I am seeking excellent examples of Ruby DSLs (Domain Specific Languages). Which repositories, projects do you know of that are worth a read? Why is it (or: are they) great

6条回答
  •  爱一瞬间的悲伤
    2020-12-14 10:28

    Ruby on Rails' Active Record is a DSL!

    http://apidock.com/rails/ActiveRecord/Base

    Also this episode of code school might be interesting as it leads up to building a DSL (where I learned Active Record was a DSL)

    http://www.codeschool.com/courses/ruby-bits-part-2

    The above course also talks about external and internal DSLs. Cucumber is an example of an external DSL where you need to build a parser and compiler, etc. Active Record is an example of an Internal DSL that runs inside some existing code.

提交回复
热议问题