A
Adam Skobi
Hi,
I'm building a DSL and trying some weird syntax structures. My DSL
should look like this.
class Root
def dsl(&block)
instance_eval(&block)
end
end
class C
#...
end
#DSL
dsl {
met1
class C1 < C
#...
end
met2
}
Is there a way that the class C1 won't be defined inside class Root
but inside C (or somewhere else)? Maybe there is a trick in Ruby (hook
method?) so that the class C1 won't be created in Root at all and than
I could pass the block somewhere else for creation?
I'm building a DSL and trying some weird syntax structures. My DSL
should look like this.
class Root
def dsl(&block)
instance_eval(&block)
end
end
class C
#...
end
#DSL
dsl {
met1
class C1 < C
#...
end
met2
}
Is there a way that the class C1 won't be defined inside class Root
but inside C (or somewhere else)? Maybe there is a trick in Ruby (hook
method?) so that the class C1 won't be created in Root at all and than
I could pass the block somewhere else for creation?