D
Daniel Schierbeck
Hi lads!
I'm looking to do something like this:
Doc.new do
foo do
bar { "value of doc -> foo -> bar" }
buz { "another text node" }
end
baz do
biz { "some text" }
end
end
So that the methods called (biz, bar, buz and baz) are called on the
same objects as the method to which they belong.
foo should be called on the Doc object, as should baz. bar and buz
should be called on an object returned by foo, etc. etc.
What I'm looking for is a way to avoid having to pass "self" to the
blocks all the time.
Daniel Schierbeck
I'm looking to do something like this:
Doc.new do
foo do
bar { "value of doc -> foo -> bar" }
buz { "another text node" }
end
baz do
biz { "some text" }
end
end
So that the methods called (biz, bar, buz and baz) are called on the
same objects as the method to which they belong.
foo should be called on the Doc object, as should baz. bar and buz
should be called on an object returned by foo, etc. etc.
What I'm looking for is a way to avoid having to pass "self" to the
blocks all the time.
Daniel Schierbeck