Class: SchemaDev::RubySelector::Chruby
- Inherits:
-
ManagerBase
- Object
- ManagerBase
- SchemaDev::RubySelector::Chruby
- Defined in:
- lib/schema_dev/ruby_selector.rb
Constant Summary collapse
- CORE_COMMAND =
"chruby-exec"
Instance Method Summary collapse
- #command(ruby) ⇒ Object
-
#initialize ⇒ Chruby
constructor
A new instance of Chruby.
Methods inherited from ManagerBase
Constructor Details
#initialize ⇒ Chruby
Returns a new instance of Chruby.
23 24 25 |
# File 'lib/schema_dev/ruby_selector.rb', line 23 def initialize @rubies = Pathname.new(ENV['HOME']).join(".rubies").entries().map(&its.basename.to_s) end |
Instance Method Details
#command(ruby) ⇒ Object
26 27 28 29 30 |
# File 'lib/schema_dev/ruby_selector.rb', line 26 def command(ruby) bash = Which.which 'bash' || abort("no bash shell found") ruby = @rubies.select(&it =~ /^(ruby-)?#{ruby}(-p.*)?$/).last || ruby "SHELL=#{bash} #{CORE_COMMAND} #{ruby} --" end |