Module: RVM

Defined in:
lib/rvm/with.rb,
lib/rvm/with/version.rb

Defined Under Namespace

Classes: ErrorLoadingRubyVersion, With

Class Method Summary collapse

Class Method Details

.with(version, &block) ⇒ Object



6
7
8
9
10
11
12
13
14
# File 'lib/rvm/with.rb', line 6

def self.with version, &block
  shell = Session::Bash.new
  stdout, stderr = shell.execute "ruby_version_path=$( rvm #{version} do rvm env -- --path ) && source $ruby_version_path"
  if shell.status == 0
    block.call(shell)
  else
    raise ErrorLoadingRubyVersion.new("Could not load ruby version '#{version}' error: '#{stderr.strip}'.")
  end
end