C
Csaba Henk
Hi!
The following, of course, works fine:
class C
def foo
yield * 2
end
end
C.new.foo {5}
=> 10
but if I do:
foop = proc { yield * 2 }
then
foop.call {5}
doesn't pass the block to yield, and if I define c as:
c = Class.new
c.senddefine_method,:foo,foop)
then
c.new.foo {5}
neither works.
Is there a way to define a method like the foo of C in the
c.senddefine_method,...) way?
Thanks,
--
Csaba
"There's more to life, than books, you know but not much more..."
[The Smiths]
***
If you want to send me a mail, see it in the mailto link at
http://www.renyi.hu/~ekho/egyelore.html
The following, of course, works fine:
class C
def foo
yield * 2
end
end
C.new.foo {5}
=> 10
but if I do:
foop = proc { yield * 2 }
then
foop.call {5}
doesn't pass the block to yield, and if I define c as:
c = Class.new
c.senddefine_method,:foo,foop)
then
c.new.foo {5}
neither works.
Is there a way to define a method like the foo of C in the
c.senddefine_method,...) way?
Thanks,
--
Csaba
"There's more to life, than books, you know but not much more..."
[The Smiths]
***
If you want to send me a mail, see it in the mailto link at
http://www.renyi.hu/~ekho/egyelore.html