Skip to content

Instantly share code, notes, and snippets.

@cheald

cheald/extend.rb Secret

Created November 6, 2014 21:53
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 cheald/50f3d82aad9a07dd06f0 to your computer and use it in GitHub Desktop.
Save cheald/50f3d82aad9a07dd06f0 to your computer and use it in GitHub Desktop.
Java::OrgJruby::RubyMethod.send :field_reader, :implementationModule
m1 = Module.new {def foo; end}
c1 = Class.new(Object) {include m1; def foo; end}
c1.new.method(:foo).to_java.implementationModule.to_java.getSuperClass()
=> #<Module:0x4c492d3b>
m2 = Module.new {def foo; end}
o = c1.new.extend(m2)
o.method(:foo).to_java.implementationModule.to_java.getSuperClass()
=> nil
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment