`ls` command does not show new Module methods properly #862

kyrylo opened this Issue Feb 24, 2013 · 2 comments

3 participants

pry member

Ruby 2.0 has new methods like prepend and refine. The ls command cannot list them properly.

[1] pry(main)> ls Module
Module.methods: constants  nesting
  <           class_name               included_modules      private_constant          
  <=          class_variable_defined?  inspect               private_instance_methods  
  <=>         class_variable_get       instance_method       private_method_defined?   
  ==          class_variable_set       instance_methods      protected_instance_methods
  ===         class_variables          method_defined?       protected_method_defined? 
  >           const_defined?           module_eval           public_class_method       
  >=          const_get                module_exec           public_constant           
  ancestors   const_missing            name                  public_instance_method    
  autoload    const_set                namespace_name        public_instance_methods   
  autoload?   constants                pretty_print          public_method_defined?    
  class_eval  freeze                   pretty_print_cycle    remove_class_variable     
  class_exec  include?                 private_class_method  to_s                      
[2] pry(main)> ls -p Module
Module.methods: constants  nesting

However, it is possible to list them, but the way we do it is a bit twisted.

[3] pry(main)> ls -p -M -v Module --grep prepend  
Module#methods: prepend  prepend_features  prepended
[4] pry(main)> ls -p Module --grep prepend  

[5] pry(main)> 

What we want is to list those methods simply with the -p switch, so the following invocation should work.

[2] pry(main)> ls -p Module
pry member

prepend and refine are Module.private_instance_methods().
So I think ls -p -M Module should return prepend and refine.
And ls -p Module should not return them.

pry member

ls -M Module shows null.
The reason is that.
In output_self method of lib/pry/commands/ls/methods.rb, resolution_order.take_while(&below_ceiling) returns []. Is it need to fix this issue?

@yui-knk yui-knk referenced this issue Jan 24, 2014

Fix ls command #1078

@rf- rf- added this to the v1.0.0 milestone Apr 29, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment