Class: RubyConfig::Switcher

Inherits:
Object
  • Object
show all
Defined in:
lib/ruby_config/switcher.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(ruby_config_path) ⇒ Switcher

Returns a new instance of Switcher.



7
8
9
10
# File 'lib/ruby_config/switcher.rb', line 7

def initialize(ruby_config_path)
  @ruby_config_path = ruby_config_path
  @config = RubyConfig::Config.new(@ruby_config_path)
end

Instance Attribute Details

#configObject (readonly)

Returns the value of attribute config.



5
6
7
# File 'lib/ruby_config/switcher.rb', line 5

def config
  @config
end

Instance Method Details



17
18
19
20
21
# File 'lib/ruby_config/switcher.rb', line 17

def set_symlinks_to_runtime(runtime)
  delete_existing_symlinks
  create_symlinks(runtime)
  set_environment(runtime)
end

#switch(runtime) ⇒ Object



12
13
14
15
# File 'lib/ruby_config/switcher.rb', line 12

def switch(runtime)    
  set_default_handle(runtime.handle)
  set_symlinks_to_runtime(runtime)
end