Class: Callisto::Shell

Inherits:
Object
  • Object
show all
Defined in:
lib/callisto/shell.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(executable, arguments) ⇒ Shell

Returns a new instance of Shell.



15
16
17
18
# File 'lib/callisto/shell.rb', line 15

def initialize(executable, arguments)
  self.executable = executable
  self.arguments = arguments
end

Instance Attribute Details

#argumentsObject

Returns the value of attribute arguments.



5
6
7
# File 'lib/callisto/shell.rb', line 5

def arguments
  @arguments
end

#executableObject

Returns the value of attribute executable.



5
6
7
# File 'lib/callisto/shell.rb', line 5

def executable
  @executable
end

Class Method Details

.bin_pathObject



11
12
13
# File 'lib/callisto/shell.rb', line 11

def self.bin_path
  @bin_path
end

.bin_path=(path) ⇒ Object



7
8
9
# File 'lib/callisto/shell.rb', line 7

def self.bin_path=(path)
  @bin_path = path
end

Instance Method Details

#commandObject



20
21
22
23
# File 'lib/callisto/shell.rb', line 20

def command
  prefix = File.join(*[self.class.bin_path, executable].compact)
  "#{prefix} #{arguments}"
end

#runObject



25
26
27
# File 'lib/callisto/shell.rb', line 25

def run
  `#{command}`.chomp
end