Ruby - Advanced Metaprogramming
How would you modify this DSL builder to allow nested blocks for steps?
class Builder
def initialize
@steps = []
end
def step(name, &block)
if block
nested_builder = Builder.new
nested_builder.instance_eval(&block)
@steps << {name => nested_builder.steps}
else
@steps << name
end
end
end