Hi --

On Thu, 12 Oct 2006, OliverMarchand wrote:

> Hello everybody,
>
> Not that I despreately need it, but I was wondering how to e.g. get the
> Object#inspect method back for some classes which override it, say just
> as an example for a Hash?
>
> Neither option I considered seems suitable:
>
> alias_method --- too late, the original method is gone
> instance_eval --- didn't work for me
> using .method and .call --- I never seemed to link the objects self to
> the Object#inspect method
>
> I am sure it is very easy...

super might be adequate:

   def inspect
     super
   end

unless there are multiple overridings along the way, in which case you
might need:

   Object.instance_method(:inspect).bind(self).call


David

-- 
                   David A. Black | dblack / wobblini.net
Author of "Ruby for Rails"   [1] | Ruby/Rails training & consultancy [3]
DABlog (DAB's Weblog)        [2] | Co-director, Ruby Central, Inc.   [4]
[1] http://www.manning.com/black | [3] http://www.rubypowerandlight.com
[2] http://dablog.rubypal.com    | [4] http://www.rubycentral.org