Class: Spiceweasel::Command

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

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

Returns a new instance of Command.



8
9
10
11
12
13
# File 'lib/spiceweasel/command.rb', line 8

def initialize(command, options={})
  @command = command.rstrip
  @options = options
  @timeout = options['timeout']
  @allow_failure = options.has_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.



4
5
6
# File 'lib/spiceweasel/command.rb', line 4

def allow_failure
  @allow_failure
end

#commandObject (readonly) Also known as: to_s

Returns the value of attribute command.



6
7
8
# File 'lib/spiceweasel/command.rb', line 6

def command
  @command
end

#timeoutObject (readonly)

Returns the value of attribute timeout.



5
6
7
# File 'lib/spiceweasel/command.rb', line 5

def timeout
  @timeout
end

Instance Method Details

#shellout_optsObject



15
16
17
18
19
# File 'lib/spiceweasel/command.rb', line 15

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