From b928092abef70ac72f14914e31185a7556dcf380 Mon Sep 17 00:00:00 2001 From: Kyrylo Silin Date: Wed, 30 Jan 2013 10:32:10 +0200 Subject: [PATCH] Do not recommend to install pry-doc in some cases There is no sense to install "pry-doc" on Ruby platforms other than MRI, since "pry-doc" is for MRI only. Although "pry-doc" works on non-MRI platforms, it still shows C source code. Haha. --- lib/pry/method.rb | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/pry/method.rb b/lib/pry/method.rb index 1d6c24011..57b923c62 100644 --- a/lib/pry/method.rb +++ b/lib/pry/method.rb @@ -481,12 +481,16 @@ def method_missing(method_name, *args, &block) private # @return [YARD::CodeObjects::MethodObject] - # @raise [CommandError] Raises when the method can't be found or `pry-doc` isn't installed. + # @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 Pry::MethodInfo.info_for(@method) or raise CommandError, "Cannot locate this method: #{name}. (source_location returns nil)" else - raise CommandError, "Cannot locate this method: #{name}. Try `gem install pry-doc` to get access to Ruby Core documentation." + fail_msg = "Cannot locate this method: #{name}." + if mri_18? || mri_19? + fail_msg += ' Try `gem-install pry-doc` to get access to Ruby Core documentation.' + end + raise CommandError, fail_msg end end