On Tue, 7 Feb 2006, Logan Capaldo wrote:

> This makes sense, If you consider the common idiom of alias'ing a method to
> wrap additional functionality around it. If alias(_method) didn't work like
> that you couldn't use it like this. alias_method doesn't work like
> assignment in ruby, its more like it creates a new method with the same
> source as the original method.
>
> As a poorly conceived alternative:
>
> % cat a.rb
> class Class
>  def shallow_alias(new_name, current_name)
>    self.module_eval <<-END
>    def #{new_name}(*args, &block)
>      #{current_name}(*args, &block)
>    end
>    END
>  end
> end
>
> class A
>  def assertion
>    raise NotImplementedError
>  end
>  shallow_alias "assertion?", "assertion"
> end
>
> class B < A
>  def assertion
>    true
>  end
> end
>
> B.new.assertion?
>
> % ruby a.rb
> %

yeah - this is pretty much what i did.  for some reason i had always assume
that alias_method worked this way.

regards.

-a

-- 
happiness is not something ready-made.  it comes from your own actions.
- h.h. the 14th dali lama