From 1e0c7cfe2bd0ad3db9e960c556b6b5d787dfda62 Mon Sep 17 00:00:00 2001 From: Conrad Irwin Date: Tue, 27 Dec 2011 22:59:08 +0000 Subject: [PATCH] A splash of idiomaticity with a side of vi --- lib/pry/pry_class.rb | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/lib/pry/pry_class.rb b/lib/pry/pry_class.rb index e851e396..f60e33c8 100644 --- a/lib/pry/pry_class.rb +++ b/lib/pry/pry_class.rb @@ -198,13 +198,8 @@ class Pry if Helpers::BaseHelpers.windows? 'notepad' else - case true - when system('which editor > /dev/null 2>&1') - 'editor' - when system('which nano > /dev/null 2>&1') - 'nano' - else - nil + %w(editor nano vi).detect do |editor| + system("which #{editor} > /dev/null 2>&1") end end end