News for hackers. Stuff that matters.
Re:Ruby DSL Handbook by towelrod on Friday February 06, 2015 @01:24PM (#9010596)
That's one of the things I like about Ruby DSLs. Because the DSL is just Ruby, you can do things like:

    [:foo, :bar].each do |attribute|
        attr_reader attribute
    end
You probably wouldn't want do actually do that with attr_reader, but it is just an example.
Re:Ruby DSL Handbook by davexunit on Friday February 06, 2015 @02:09PM (#9010893)
Typically, you'd write syntactic sugar on top of regular functions, so that the underlying API is available in the host language to do things like in your example. Using Ruby's class syntax as an example, it gives you a convenient means to describe classes, but underneath that is an API for programmatic manipulation of class objects.