------art_23080_21152739.1152884194650
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

[snip]
>
>
> >
> Excellent. Don't use the & to convert the Proc into a block - just use
> the method reference directly.


Too much honor, I seem to post too fast, furthermore the idea is ara's not
mine :)

Are you getting the "singleton method called for a different object
> (TypeError)" error?
>
> Thanks,
> Sean
>
>
Exactly
and though my original code is not well documenting the behavior ara is
exploiting it really does seem to be a problem because of the "internal"
nature of IO.
Here is eventually the code mimicking the structure of the inherited class
method "open" and one can see that it works perfectly well:

class X # role of IO
    class << self
        def x(*args,&block) # role of open
            block.call(1764) if block
        end
    end
end

OLD  .method :x

class Y < X # role of File
    class << self
        def x; "rubbish"; end
    end
end

class Y
    class << self
        define_method(:x, OLD )
    end

end

Y.x{ |a| puts a }

Cheers
Robert

------art_23080_21152739.1152884194650--