Skip to content

Instantly share code, notes, and snippets.

@floehopper
Last active October 11, 2016 18:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save floehopper/59b3ae48520f6ba5e306219d84e85f3d to your computer and use it in GitHub Desktop.
Save floehopper/59b3ae48520f6ba5e306219d84e85f3d to your computer and use it in GitHub Desktop.
Calling Object#method hangs for private method defined on module then made public once it's been used to extend class
module Foo
private
def foo
"foo"
end
end
class Bar
extend Foo
class << self
public :foo
end
end
Bar.foo # => "foo"
Bar.method(:foo) # => #<Method: Class(Bar)#foo>
module Baz
end
class Bar
class << self
prepend Baz
end
end
Bar.method(:foo) # => hangs!
@floehopper
Copy link
Author

OK

  • ruby 2.0.0p648 (2015-12-16 revision 53162) [x86_64-darwin14.5.0]
  • ruby 2.1.0p0 (2013-12-25 revision 44422) [x86_64-darwin14.0]
  • ruby 2.1.1p76 (2014-02-24 revision 45161) [x86_64-darwin14.0]
  • ruby 2.1.2p95 (2014-05-08 revision 45877) [x86_64-darwin14.0]

Hangs

  • ruby 2.1.3p242 (2014-09-19 revision 47630) [x86_64-darwin14.0]
  • ruby 2.1.5p273 (2014-11-13 revision 48405) [x86_64-darwin14.0]
  • ruby 2.1.10p492 (2016-04-01 revision 54464) [x86_64-darwin14.0]
  • ruby 2.2.5p319 (2016-04-26 revision 54774) [x86_64-darwin14]
  • ruby 2.3.1p112 (2016-04-26 revision 54768) [x86_64-darwin14]
  • ruby 2.4.0preview2 (2016-09-09 trunk 56129) [x86_64-darwin14]

@floehopper
Copy link
Author

Ruby bug report submitted - https://bugs.ruby-lang.org/issues/12832

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment