summaryrefslogtreecommitdiff
path: root/lib/delegate.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/delegate.rb')
-rw-r--r--lib/delegate.rb8
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/delegate.rb b/lib/delegate.rb
index 30b1a32c12..205d5e1fbd 100644
--- a/lib/delegate.rb
+++ b/lib/delegate.rb
@@ -8,12 +8,12 @@
# Usage:
# foo = Object.new
# foo = SimpleDelegator.new(foo)
-# foo.type # => Object
+# foo.hash == foo2.hash # => true
class Delegator
def initialize(obj)
- preserved = ["id", "equal?", "__getobj__"]
+ preserved = ["type", "id", "equal?", "__getobj__"]
for t in self.type.ancestors
preserved |= t.instance_methods
break if t == Delegator
@@ -52,6 +52,6 @@ SimpleDelegater = SimpleDelegator
if __FILE__ == $0
foo = Object.new
- foo = SimpleDelegator.new(foo)
- p foo.type # => Object
+ foo2 = SimpleDelegator.new(foo)
+ p foo.hash == foo2.hash # => true
end