mirror of
https://github.com/pry/pry.git
synced 2022-11-09 12:35:05 -05:00
Fix Class/Module confusion
This commit is contained in:
parent
3e848fa5f9
commit
f6520da3e1
2 changed files with 7 additions and 1 deletions
|
@ -132,7 +132,7 @@ class Pry
|
|||
# This is required to introspect methods on objects like Net::HTTP::Get that
|
||||
# have overridden the `method` method.
|
||||
def safe_send(obj, method, *args, &block)
|
||||
(Class === obj ? Class : Object).instance_method(method).bind(obj).call(*args, &block)
|
||||
(Module === obj ? Module : Object).instance_method(method).bind(obj).call(*args, &block)
|
||||
end
|
||||
|
||||
# Get the singleton classes of superclasses that could define methods on
|
||||
|
|
|
@ -81,6 +81,12 @@ describe "ls" do
|
|||
end
|
||||
end
|
||||
|
||||
describe "when inside Modules" do
|
||||
it "should still work" do
|
||||
mock_pry("cd Module.new{ def foobie; end }", "ls -M").should =~ /foobie/
|
||||
end
|
||||
end
|
||||
|
||||
describe "constants" do
|
||||
it "should show constants defined on the current module" do
|
||||
mock_pry("class TempFoo1; BARGHL = 1; end", "ls TempFoo1").should =~ /BARGHL/
|
||||
|
|
Loading…
Reference in a new issue