Class: Mediakit::Drivers::FakeDriver

Inherits:
PopenDriver show all
Defined in:
lib/mediakit/drivers.rb

Instance Attribute Summary collapse

Attributes inherited from Base

#bin

Instance Method Summary collapse

Methods inherited from PopenDriver

#command, #parse_options

Methods inherited from Base

#command, #initialize

Constructor Details

This class inherits a constructor from Mediakit::Drivers::Base

Instance Attribute Details

#error_outputObject

Returns the value of attribute error_output.



66
67
68
# File 'lib/mediakit/drivers.rb', line 66

def error_output
  @error_output
end

#exit_statusObject

Returns the value of attribute exit_status.



66
67
68
# File 'lib/mediakit/drivers.rb', line 66

def exit_status
  @exit_status
end

#last_commandObject

Returns the value of attribute last_command.



66
67
68
# File 'lib/mediakit/drivers.rb', line 66

def last_command
  @last_command
end

#niceObject

Returns the value of attribute nice.



66
67
68
# File 'lib/mediakit/drivers.rb', line 66

def nice
  @nice
end

#outputObject

Returns the value of attribute output.



66
67
68
# File 'lib/mediakit/drivers.rb', line 66

def output
  @output
end

#timeoutObject

Returns the value of attribute timeout.



66
67
68
# File 'lib/mediakit/drivers.rb', line 66

def timeout
  @timeout
end

Instance Method Details

#resetObject



85
86
87
# File 'lib/mediakit/drivers.rb', line 85

def reset
  @last_command, @output, @error_output, @exit_status, @timeout, @nice = nil
end

#run(args) ⇒ String #run(*args, options) ⇒ String

fake driver for testing

Overloads:

  • #run(args) ⇒ String

    Parameters:

    • args (String)

      string argument for command

  • #run(*args, options) ⇒ String

    Parameters:

    • args (Array)

      arguments for command

Returns:

  • (String)

    stdout output



76
77
78
79
80
81
82
83
# File 'lib/mediakit/drivers.rb', line 76

def run(*args)
  @last_command = command(*args)

  options, rest_args = parse_options(args.dup)
  @timeout = options[:timeout] if options[:timeout]
  @nice = options[:nice] if options[:nice]
  [(output || ''), (error_output || ''), (exit_status || true)]
end