transfire / gmail.com wrote:
> class RWDelegator
> 
>   def initialize( write, &read )
>     @read = read
>     @write = write
> 
>     read_class = @read.call.object_class
> 
>     unless read_class.method_defined?(:eq_with_rwdelegator?)
>       read_class.class_eval %{
>         def eq_with_rwdelegator?( other )
>           if RWDelegator === other
>             other == self
>           else
>             eq_without_rwdelegator?(other)
>           end
>         end
>         alias_method :eq_without_rwdelegator?, :==
>         alias_method :==, :eq_with_rwdelegator?
>       }
>     end
>   end
> 
>   ...
> 
> T.
> 
> 

The above approach would not scale seamlessly should you have another
RWDelegator-like class.

I would be interested in knowing the situation that required something
like this.

JS