Skip to content

Instantly share code, notes, and snippets.

@yangchenyun
Created July 4, 2013 11:23
Show Gist options
  • Save yangchenyun/5926916 to your computer and use it in GitHub Desktop.
Save yangchenyun/5926916 to your computer and use it in GitHub Desktop.
require 'delegate'
class A
end
class B < SimpleDelegator
def initialize(obj)
super(obj)
end
end
a = A.new
puts a.is_a? A # true
b = B.new(A.new)
# is_a? is not delegating to the delegated object
puts b.is_a? A # false
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment