Forum: JRuby Reopening class in module : jruby and MRI differ

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Da57cffaec80533bee0d0446b3ea6fcd?d=identicon&s=25 Michel Demazure (badal)
on 2009-03-29 03:15
Consider the following example :

module MyModule
  class MyClass
    private
    def my_method
      puts "A"
    end
  end
end

include MyModule

class MyClass
  public :my_method
end

MyClass.new.my_method

This works both in ruby-1.8.6 and ruby-1.9.1.
Jruby gives "undefined method 'my_method' for class 'MyClass'
(NameError)".
I feel that jruby is somehow "right" and MRI "wrong", but ...
Da57cffaec80533bee0d0446b3ea6fcd?d=identicon&s=25 Michel Demazure (badal)
on 2009-03-29 08:40
Michel Demazure wrote:
> Consider the following example :

Better an clearer example :

module MyModule
  class MyClass
    def self.my_method
      puts "old"
    end
  end
end

include MyModule

class MyClass
  def self.my_method
    puts "new"
  end
end

MyClass.my_method
::MyModule::MyClass.my_method

MRI says :
new
new

jruby says
new
old

Feature ? Bug ?
This topic is locked and can not be replied to.