summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKyrylo Silin <silin@kyrylo.org>2019-05-02 23:36:00 +0300
committerKyrylo Silin <silin@kyrylo.org>2019-05-02 23:38:30 +0300
commit61fa19b1f04511173abb70f3d1814f03ed2d6a13 (patch)
tree7e97b929d030896b7d84d2f01a5d784628f12abf
parented45fb3087029f82d9a93497100b35235dd13335 (diff)
downloadpry-61fa19b1f04511173abb70f3d1814f03ed2d6a13.tar.gz
commands/show_info: fix formatting error for C method header
Fixes #2006 (show-source formatting bug in From) In order to test this I had to build Pry from master locally and install it. When I ran `String#initialize` I saw an error that `has_pry_doc` is undefined on the Config class. This makes sense. This option is defined in the pry-doc plugin. As a workaround, I had to change the check to `defined?`. However, in the future, we should make Pry plugin-agnostic - strictly no plugin checks in the code.
-rw-r--r--lib/pry/commands/show_info.rb2
-rw-r--r--lib/pry/method.rb2
2 files changed, 2 insertions, 2 deletions
diff --git a/lib/pry/commands/show_info.rb b/lib/pry/commands/show_info.rb
index a6648393..2f78d0c3 100644
--- a/lib/pry/commands/show_info.rb
+++ b/lib/pry/commands/show_info.rb
@@ -139,7 +139,7 @@ class Pry
def method_header(code_object, line_num)
h = ""
- h << (code_object.c_method? ? "(C Method):" : ":#{line_num}:")
+ h << (code_object.c_method? ? ' (C Method):' : ":#{line_num}:")
h << method_sections(code_object)[:owner]
h << method_sections(code_object)[:visibility]
h << method_sections(code_object)[:signature]
diff --git a/lib/pry/method.rb b/lib/pry/method.rb
index 6ef1535f..3301ae6f 100644
--- a/lib/pry/method.rb
+++ b/lib/pry/method.rb
@@ -514,7 +514,7 @@ class Pry
# @return [YARD::CodeObjects::MethodObject]
# @raise [CommandError] when the method can't be found or `pry-doc` isn't installed.
def pry_doc_info
- if Pry.config.has_pry_doc
+ if defined?(PryDoc)
Pry::MethodInfo.info_for(@method) ||
raise(
CommandError,