From 76ba96282b2404fbe620e938f538f97bc8ed4968 Mon Sep 17 00:00:00 2001 From: Matt Foster Date: Sun, 9 Jan 2011 22:13:35 +0000 Subject: [PATCH] Update to use new get-ruby-version function. Also refactor to pull out common irb arguments. --- 05_ruby | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/05_ruby b/05_ruby index f4753c8..4d13a95 100644 --- a/05_ruby +++ b/05_ruby @@ -1,10 +1,20 @@ -# Convenient. Also works in Gentoo or Ubuntu -if [[ -x $(which irb$(get_ruby_version)) ]]; then - alias irb='irb1.9.1 --readline -r irb/completion' +# +# Set up ruby +# +autoload -U get-ruby-version && get-ruby-version + +# If you alias ruby to (say) ruby 1.9, this should update irb too. +# You might want to alias 'gem' here too, if you do, remember to update your path. +local irb_options="--readline -r irb/completion" + +if [[ -x $(which irb$RUBY_VERSION) ]]; then + alias irb='irb$RUBY_VERSION $irb_options' else - alias irb='irb --readline -r irb/completion' + alias irb="irb $irb_options" fi + export RI='-f ansi --width 70' + if [[ -x `which fri` ]]; then alias ri=fri fi