Class: Ready::ByExecutable
- Inherits:
-
Object
- Object
- Ready::ByExecutable
- Defined in:
- lib/ready/by_executable.rb
Overview
Builds the ruby invocation used to run the "by" executable, toggling rubygems and YJIT, and renders it as a shell alias.
Instance Method Summary collapse
- #command_args ⇒ Object
-
#initialize(current_ruby: RbConfig.ruby, by_bin: Gem.activate_bin_path("by", "by")) ⇒ ByExecutable
constructor
A new instance of ByExecutable.
- #to_alias ⇒ Object
- #with_rubygems ⇒ Object
- #with_yjit ⇒ Object
- #without_rubygems ⇒ Object
- #without_yjit ⇒ Object
Constructor Details
#initialize(current_ruby: RbConfig.ruby, by_bin: Gem.activate_bin_path("by", "by")) ⇒ ByExecutable
Returns a new instance of ByExecutable.
8 9 10 11 12 13 14 15 |
# File 'lib/ready/by_executable.rb', line 8 def initialize( current_ruby: RbConfig.ruby, by_bin: Gem.activate_bin_path("by", "by") ) @current_ruby = current_ruby @by_bin = by_bin @args = [] end |
Instance Method Details
#command_args ⇒ Object
37 38 39 40 41 42 43 |
# File 'lib/ready/by_executable.rb', line 37 def command_args [ @current_ruby, *@args, @by_bin, ] end |
#to_alias ⇒ Object
45 46 47 48 49 |
# File 'lib/ready/by_executable.rb', line 45 def to_alias command_args .then { Shellwords.join(it) } .then { "#{it} \"${@}\"" } end |
#with_rubygems ⇒ Object
22 23 24 25 |
# File 'lib/ready/by_executable.rb', line 22 def with_rubygems @args.delete "--disable-gems" self end |
#with_yjit ⇒ Object
27 28 29 30 |
# File 'lib/ready/by_executable.rb', line 27 def with_yjit @args << "--yjit" self end |
#without_rubygems ⇒ Object
17 18 19 20 |
# File 'lib/ready/by_executable.rb', line 17 def without_rubygems @args << "--disable-gems" unless @args.include? "--disable-gems" self end |
#without_yjit ⇒ Object
32 33 34 35 |
# File 'lib/ready/by_executable.rb', line 32 def without_yjit @args.delete("--yjit") self end |