[MacRuby] #204: Private methods redefined public are still in private_methods

MacRuby ruby-noreply at macosforge.org
Sat Jun 4 14:13:31 PDT 2011


#204: Private methods redefined public are still in private_methods
----------------------------------------+-----------------------------------
 Reporter:  vincent.isambart@…          |       Owner:  eloy.de.enige@…        
     Type:  defect                      |      Status:  new                    
 Priority:  blocker                     |   Milestone:  MacRuby Later          
Component:  MacRuby                     |    Keywords:  #reduction             
----------------------------------------+-----------------------------------

Comment(by christian@…):

 Replying to [comment:6 lsansonetti@…]:
 > This problem does not seem critical for 1.0, moving to Later.

 I disagree: this bug causes 'bundler exec' to fail with the message 'Could
 not find task "exec".' Bundler is a very important gem for me, and of
 course a requirement for Rails 3.

 'bundler exec' fails because the #exec method is both public and private
 on the Kernel module:

 {{{
 Kernel.public_methods & Kernel.private_methods
 => [:load_plist, :load_bridge_support_file, :binding, :lambda, :proc,
 :framework, :autoload?, :autoload, :require, :load, :abort, :exit, :sleep,
 :spawn, :system, :exit!, :fork, :exec, :trap, :rand, :srand, :getpass,
 :test, :display, :p, :`, :readlines, :select, :readline, :gets, :puts,
 :putc, :print, :printf, :open, :syscall, :at_exit, :untrace_var,
 :trace_var, :caller, :loop, :throw, :catch, :local_variables,
 :global_variables, :raise, :fail, :block_given?, :iterator?, :eval, :warn,
 :Array, :String, :Float, :Integer, :format, :sprintf]
 }}}

 Bundler uses the Thor gem to define its command line, and Thor excludes
 private or protected methods from command-line parsing:

 {{{
     def public_method?(instance) #:nodoc:
       collection = instance.private_methods + instance.protected_methods
       (collection & [name.to_s, name.to_sym]).empty?
     end
 }}}
 (From https://github.com/wycats/thor/blob/master/lib/thor/task.rb#L69 )

 This implementation doesn't seem wrong to me, though it would obviously
 work if they had checked for inclusion in #public_methods instead.

 For the same reason the 'bundler open' command also fails with the same
 message.

-- 
Ticket URL: <http://www.macruby.org/trac/ticket/204#comment:7>
MacRuby <http://macruby.org/>



More information about the macruby-tickets mailing list