Class: Balmora::Context::Exec

Inherits:
Balmora::Context show all
Defined in:
lib/balmora/context/exec.rb

Direct Known Subclasses

ExecResult

Instance Method Summary collapse

Methods inherited from Balmora::Context

#_not, #execute, #init, #initialize, #option

Methods inherited from Balmora::Command

#_execute, #execute, #init, #initialize, #option

Constructor Details

This class inherits a constructor from Balmora::Context

Instance Method Details

#_execObject



19
20
21
22
23
24
# File 'lib/balmora/context/exec.rb', line 19

def _exec()
  exec = option(:exec)
  if exec.instance_of?(::String)
    exec = [@shell.expression(exec)]
  end
end

#optionsObject



3
4
5
# File 'lib/balmora/context/exec.rb', line 3

def options()
  return super().concat([:exec])
end

#runObject



15
16
17
# File 'lib/balmora/context/exec.rb', line 15

def run()
  return @shell.run!(_exec(), verbose: false).rstrip()
end

#verifyObject



7
8
9
10
11
12
13
# File 'lib/balmora/context/exec.rb', line 7

def verify()
  if !@exec
    raise Error.new('"exec" should be defined')
  end

  super()
end