H
hochherz
is there a way to use a proc like a method?
like:
class A
def initialize
@av=10;
end
def do(mproc)
mproc.call();
end
def rt()
@av;
end
end
a=proc{@av=111} #something different
b=A.new
b.do(a)
b.rt #return -> 111
is it possible by makeing subclass of proc to do this?
like:
class A
def initialize
@av=10;
end
def do(mproc)
mproc.call();
end
def rt()
@av;
end
end
a=proc{@av=111} #something different
b=A.new
b.do(a)
b.rt #return -> 111
is it possible by makeing subclass of proc to do this?