public

Shows a JRuby implementation of a Java interface that surprisingly works with 'include' statement.

  • Download Gist
jruby-include-question.rb
Ruby
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
# Shouldn't this fail with the 'include Runnable' disabled?
 
require 'java'
 
java_import 'java.lang.Runnable'
 
class SampleRunnable
# include Runnable
def run
puts "I'm running!"
end
end
 
new_thread = java.lang.Thread.new(SampleRunnable.new)
new_thread.start
new_thread.join

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.