From 13c1a615a31c3d2da3b54747c69cc1ff30f23961 Mon Sep 17 00:00:00 2001 From: Conrad Irwin Date: Mon, 28 May 2012 01:02:46 -0700 Subject: [PATCH] Use File.basename not regex, thanks Mon_Ouie --- lib/pry/helpers/command_helpers.rb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/pry/helpers/command_helpers.rb b/lib/pry/helpers/command_helpers.rb index 2921e77c..f509409e 100644 --- a/lib/pry/helpers/command_helpers.rb +++ b/lib/pry/helpers/command_helpers.rb @@ -154,8 +154,13 @@ class Pry # This is useful for deciding which flags we pass to the editor as # we can just use the program's name and ignore any absolute paths. # + # @example + # Pry.config.editor="/home/conrad/bin/textmate -w" + # editor_name + # # => textmate + # def editor_name - Pry.config.editor.split(%r{[\\/]}).last.split(" ").first + File.basename(Pry.config.editor).split(" ").first end # Remove any common leading whitespace from every line in `text`.