A Domain Specific Language (DSL) is a computer language targeted to a particular kind of problem or application domain. There are various ways to implement a DSL in Ruby: classic blocks, instance_eval or mixins and extend. Most often instance_eval is used. How does it work? First one has to define the DSL itself, for example [...]
Posts Tagged ‘blocks’
DSL in Ruby
Posted in development, ruby, tagged blocks, dsl, instance_eval, mixins, ruby on May 29, 2009 | 1 Comment »
Blocks, procs, and arguments in Ruby
Posted in development, ruby, rubyonrails, tagged blocks, development, lambda, procs, ruby, rubyonrails on May 19, 2009 | Leave a Comment »
Understanding Ruby blocks, Procs and methods is not easy for a Ruby beginner, especially if Procs and Lambdas are involved. Yet the basic elements are simple, as Matz says, blocks are basically nameless functions. You can pass a nameless function to another function, and then that function can invoke the passed-in nameless function.
An ampersand in [...]