mirror of
https://github.com/pry/pry.git
synced 2022-11-09 12:35:05 -05:00
157c7db32a
Fixes https://github.com/pry/pry/issues/1596 (Unable to inspect object built from class) Replaces https://github.com/pry/pry/pull/1719 Big thanks to @egwspiti for the repro case and the proposed PR. When a class redefines `respond_to?` or `method_missing` this leads to some problems and confuses Pry. I found another example where Pry misbehaves: ``` [1] pry(main)> cd Class.new { def method_missing(*) end; def respond_to_missing?(*) true end; }.new NoMethodError: private method `eval' called for nil:NilClass from /Users/kyrylo/.gem/ruby/2.4.2/gems/pry-0.11.3/lib/pry/pry_instance.rb:163:in `inject_local' ``` By using `method_defined?` we can work around these bugs since this method doesn't check whether the receiver responds to a certain message but checks whether this method is defined (so we don't redefine it later). Seems like a win-win. |
||
---|---|---|
.. | ||
cat | ||
amend_line_spec.rb | ||
bang_spec.rb | ||
cat_spec.rb | ||
cd_spec.rb | ||
disable_pry_spec.rb | ||
edit_spec.rb | ||
exit_all_spec.rb | ||
exit_program_spec.rb | ||
exit_spec.rb | ||
find_method_spec.rb | ||
gem_list_spec.rb | ||
gist_spec.rb | ||
help_spec.rb | ||
hist_spec.rb | ||
jump_to_spec.rb | ||
ls_spec.rb | ||
play_spec.rb | ||
raise_up_spec.rb | ||
reload_code_spec.rb | ||
ri_command_spec.rb | ||
save_file_spec.rb | ||
shell_command_spec.rb | ||
show_doc_spec.rb | ||
show_input_spec.rb | ||
show_source_spec.rb | ||
watch_expression_spec.rb | ||
whereami_spec.rb | ||
wtf_spec.rb |