Class: Spiceweasel::Command

Inherits:
Object
  • Object
show all
Defined in:
lib/spiceweasel/command.rb

Overview

prepares shellout calls

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(command, options = {}) ⇒ Command

Returns a new instance of Command.



27
28
29
30
31
32
# File 'lib/spiceweasel/command.rb', line 27

def initialize(command, options = {})
  @command = command.rstrip
  @options = options
  @timeout = options['timeout']
  @allow_failure = options.key?('allow_failure') ? options['allow_failure'] : true
end

Instance Attribute Details

#allow_failureObject (readonly) Also known as: allow_failure?

Returns the value of attribute allow_failure.



23
24
25
# File 'lib/spiceweasel/command.rb', line 23

def allow_failure
  @allow_failure
end

#commandObject (readonly) Also known as: to_s

Returns the value of attribute command.



25
26
27
# File 'lib/spiceweasel/command.rb', line 25

def command
  @command
end

#timeoutObject (readonly)

Returns the value of attribute timeout.



24
25
26
# File 'lib/spiceweasel/command.rb', line 24

def timeout
  @timeout
end

Instance Method Details

#shellout_optsObject



34
35
36
37
38
# File 'lib/spiceweasel/command.rb', line 34

def shellout_opts
  opts = {}
  opts[:timeout] = timeout if timeout
  opts
end