Skip to content

Commit

Permalink
Combine the .ruby-version check with the read. (@zendeavor)
Browse files Browse the repository at this point in the history
  • Loading branch information
postmodern committed Aug 5, 2013
1 parent 634da62 commit 4f51459
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions share/chruby/auto.sh
Expand Up @@ -2,15 +2,10 @@ unset RUBY_AUTO_VERSION

function chruby_auto() {
local dir="$PWD"
local version_file
local version

until [[ -z "$dir" ]]; do
version_file="$dir/.ruby-version"

if [[ -f "$version_file" ]]; then
read -r version < "$version_file"

if { read -r version <"$dir/.ruby-version"; } 2>/dev/null; then
if [[ "$version" == "$RUBY_AUTO_VERSION" ]]; then return
else
RUBY_AUTO_VERSION="$version"
Expand Down

0 comments on commit 4f51459

Please sign in to comment.