Class: Cumuli::CLI::Commander
- Inherits:
-
Object
- Object
- Cumuli::CLI::Commander
- Defined in:
- lib/cumuli/cli/commander.rb
Instance Attribute Summary collapse
-
#command ⇒ Object
readonly
Returns the value of attribute command.
Instance Method Summary collapse
- #build ⇒ Object
-
#initialize(command) ⇒ Commander
constructor
A new instance of Commander.
- #rvm_preface ⇒ Object
- #rvm_version ⇒ Object
- #rvmrc? ⇒ Boolean
- #rvmrc_descriptor ⇒ Object
Constructor Details
#initialize(command) ⇒ Commander
Returns a new instance of Commander.
6 7 8 |
# File 'lib/cumuli/cli/commander.rb', line 6 def initialize(command) @command = command end |
Instance Attribute Details
#command ⇒ Object (readonly)
Returns the value of attribute command.
4 5 6 |
# File 'lib/cumuli/cli/commander.rb', line 4 def command @command end |
Instance Method Details
#build ⇒ Object
10 11 12 |
# File 'lib/cumuli/cli/commander.rb', line 10 def build "#{rvm_preface} #{command}" end |
#rvm_preface ⇒ Object
14 15 16 |
# File 'lib/cumuli/cli/commander.rb', line 14 def rvm_preface "rvm ruby-#{rvm_version} exec" if rvmrc? end |
#rvm_version ⇒ Object
26 27 28 |
# File 'lib/cumuli/cli/commander.rb', line 26 def rvm_version File.read(rvmrc_descriptor).match(/(\d\.\d\.\d@\w+)/)[0] end |
#rvmrc? ⇒ Boolean
22 23 24 |
# File 'lib/cumuli/cli/commander.rb', line 22 def rvmrc? File.exist?(rvmrc_descriptor) end |
#rvmrc_descriptor ⇒ Object
18 19 20 |
# File 'lib/cumuli/cli/commander.rb', line 18 def rvmrc_descriptor './.rvmrc' end |