Skip to content

Instantly share code, notes, and snippets.

@justinko
Created January 30, 2012 08:43
Show Gist options
  • Save justinko/1703386 to your computer and use it in GitHub Desktop.
Save justinko/1703386 to your computer and use it in GitHub Desktop.
Ruby 1.9 Delegator bug
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