methods created via define_method are private but should be public
------------------------------------------------------------------

                 Key: JRUBY-2831
                 URL: http://jira.codehaus.org/browse/JRUBY-2831
             Project: JRuby
          Issue Type: Bug
    Affects Versions: JRuby 1.1.3
            Reporter: Martin
            Assignee: Thomas E Enebo


When adding a method via define_method the new method is private but should be 
public as the Ruby-documentation shows.
Running the following script with standard ruby no error occurs. Jruby breaks 
with 
./test.rb:14: private method `AA' called for #<A:0x4ac216> (NoMethodError)

class A
  def create_method(name, &block)
    self.class.send(:define_method, name, &block)
  end
end

a = A.new

a.create_method(:AA) { puts "Hi" }
puts "Private"
p a.private_methods(false).sort
puts "Public"
p a.public_methods(false).sort
a.AA


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply via email to