From: ara.t.howard@... Date: 2007-03-09T08:15:51+09:00 Subject: Re: how to aliase a module method? On Fri, 9 Mar 2007 dseiler@etceteraedutainment.com wrote: > On Mar 8, 5:34 am, Xavier Noria wrote: >> I am trying to aliase a module method to some local alias (to ease >> some template). I've tried a few variations of >> >> alias escape_latex MyUtils.escape_latex >> >> without luck so far. I could mixin the module or write a wrapper, but >> I'd like to know how to accomplish that with alias, or that it is not >> possible if that's the case. > > It's possible, sort of. Try > > module TheModule > instance_eval "alias escape_latex MyUtils.escape_latex" > end > > I use a similar technique (originally suggested by Minero Aoki, > according to my notes) to replace Thread.critical and > Thread.critical=. I've only tested it in 1.8.2 but I don't think > anything's broken it since then. > >> -- fxn module M class << self alias_method 'dst', 'src' end end -a -- be kind whenever possible... it is always possible. - the dalai lama