Created
January 30, 2012 08:43
-
-
Save justinko/1703386 to your computer and use it in GitHub Desktop.
Ruby 1.9 Delegator bug
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'delegate' | |
A = Struct.new(:a) | |
class B < DelegateClass(A) | |
attr_accessor :foo | |
end | |
b = B.new(A.new(5)) | |
puts b.inspect | |
puts b.respond_to?(:foo) | |
module Kernel | |
def should | |
raise self.methods.grep(/foo/).inspect # should include "foo", as it does on 1.8.7 | |
end | |
end | |
b.should |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment