Project

General

Profile

Actions

Bug #2224

closed

lib/delegate: operator delegation

Added by marcandre (Marc-Andre Lafortune) over 14 years ago. Updated almost 13 years ago.

Status:
Closed
Target version:
ruby -v:
ruby 1.9.2dev (2009-10-17 trunk 25379) [x86_64-darwin10.0.0]
Backport:
[ruby-core:26139]

Description

=begin
The operators ==, =~, !~ are forwarded by Delegate. I presume the operators != and ~, new in 1.9, have simply been forgotten?

As for eql? and hash, this is probably intentional. I am still curious as to why, since this can yield surprising results (at least to me):

a = "foo"
a1 = SimpleDelegator.new(a)
a2 = a1.dup
h = {}
h[a] = :bar
h[a1] = :bar
h[a2] = :bar
h # ==> {"foo"=>:bar, "foo"=>:bar, "foo"=>:bar}
=end

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0