From 6d0fd059f161b1f7a41cc8a0e69c5b7fc982e97f Mon Sep 17 00:00:00 2001 From: Jordon Bedwell Date: Mon, 26 Dec 2011 18:28:48 -0600 Subject: [PATCH] Reduce the code and reduce fallbacks to 'please' the girls ;) Signed-off-by: Jordon Bedwell --- lib/pry/pry_class.rb | 21 +++++---------------- 1 file changed, 5 insertions(+), 16 deletions(-) diff --git a/lib/pry/pry_class.rb b/lib/pry/pry_class.rb index c381fb1a..315816c9 100644 --- a/lib/pry/pry_class.rb +++ b/lib/pry/pry_class.rb @@ -192,28 +192,17 @@ class Pry end def self.default_editor_for_platform - if RbConfig::CONFIG['host_os'] =~ /mswin|mingw/ - ENV['VISUAL'] || ENV['EDITOR'] || "notepad" - else - if ENV['VISUAL'] and not ENV['VISUAL'].empty? - return ENV['VISUAL'] - else - if ENV['EDITOR'] and not ENV['EDITOR'].empty? - return ENV['EDITOR'] - end - end + return ENV['VISUAL'] if ENV['VISUAL'] and not ENV['VISUAL'].empty? + return ENV['EDITOR'] if ENV['EDITOR'] and not ENV['EDITOR'].empty? + if RbConfig::CONFIG['host_os'] =~ /mswin|mingw/ + 'notepad' + else case true when system('which editor > /dev/null 2>&1') 'editor' when system('which nano > /dev/null 2>&1') 'nano' - when system('which vim > /dev/null 2>&1') - 'vim' - when system('which vi > /dev/null 2>&1') - 'vi' - when system('which vim.tiny > /dev/null 2>&1') - 'vim-tiny' else nil end