`ls` command is broken inside modules #529

Closed
banister opened this Issue Apr 14, 2012 · 1 comment

2 participants

@banister
pry member
[23] (pry) main: 0> module U                                                                                                             
[23] (pry) main: 0* end                                                                                                                  
=> nil
[24] (pry) main: 0> cd U                                                                                                                 
[25] (pry) main / U: 1> ls                                                                                                               
TypeError: bind argument must be an instance of Class
from /Users/john/.rvm/gems/ruby-1.9.3-p125/gems/pry-0.9.8.4/lib/pry/default_commands/ls.rb:91:in `bind'
[26] (pry) main / U: 1> cat --ex                                                                                                         
Exception: TypeError: bind argument must be an instance of Class
--
From: /Users/john/.rvm/gems/ruby-1.9.3-p125/gems/pry-0.9.8.4/lib/pry/default_commands/ls.rb @ line 91 @ level: 0 of backtrace (of 30).

    86:           end
    87: 
    88:           if show_ivars
    89:             klass = (Module === obj ? obj : obj.class)
    90:             output_section("instance variables", format_variables(:instance_var, grep[Object.instance_method(:instance_variables).bind(obj).call]))
 => 91:             output_section("class variables", format_variables(:class_var, grep[Class.instance_method(:class_variables).bind(klass).call]))
    92:           end
    93: 
    94:           if show_locals
    95:             output_section("locals", format_locals(grep[target.eval("local_variables")]))
    96:           end
[27] (pry) main / U: 1> 
@banister
pry member

I think simply changing Class.instance_method to Module.instance_method will fix it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment