M
Meinrad Recheis
------=_Part_1901_6993034.1141724373102
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline
hello fellow rubyists,
is there an elegant way to define a singleton method from a given symbol
without using eval? what i am doing is this:
def make_wrapper object, method
eval %{
def object.#{method}
# do something here
super # call the wrapped method
end
}
end
# example of usage:
make_wrapper STDOUT, uts
using eval works, but it seems not to be the best solution. is there
annother way do define methods from a given symbol?
-- henon
------=_Part_1901_6993034.1141724373102--
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline
hello fellow rubyists,
is there an elegant way to define a singleton method from a given symbol
without using eval? what i am doing is this:
def make_wrapper object, method
eval %{
def object.#{method}
# do something here
super # call the wrapped method
end
}
end
# example of usage:
make_wrapper STDOUT, uts
using eval works, but it seems not to be the best solution. is there
annother way do define methods from a given symbol?
-- henon
------=_Part_1901_6993034.1141724373102--