1
0
Fork 0
mirror of https://github.com/pry/pry.git synced 2022-11-09 12:35:05 -05:00

Use File.basename not regex, thanks Mon_Ouie

This commit is contained in:
Conrad Irwin 2012-05-28 01:02:46 -07:00
parent e306ff5584
commit 13c1a615a3

View file

@ -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`.