lib/backticks.rb in backticks-0.3.1 vs lib/backticks.rb in backticks-0.4.0

- old
+ new

@@ -3,34 +3,41 @@ require_relative 'backticks/command' require_relative 'backticks/runner' require_relative 'backticks/ext' module Backticks - # Run a command; return a Command object that can be used to interact with - # the running process. + # Run a command with default invocation options; return a Command object that + # can be used to interact with the running process. # - # @param [String] cmd + # @param [Array] sugar list of command words and options # @return [Backticks::Command] a running command - def self.new(cmd) - Backticks::Runner.new.command(cmd) + # @see Backticks::Runner#run for a better description of sugar + # @see Backticks::Runner for more control over process invocation + def self.new(*sugar) + Backticks::Runner.new.run(*sugar) end - # Run a command; return its stdout. + # Run a command with default invocation options; wait for to exit, then return + # its output. Populate $? with the command's status before returning. # - # @param [String] cmd + # @param [Array] sugar list of command words and options # @return [String] the command's output - def self.run(cmd) - command = self.new(*cmd) + # @see Backticks::Runner#run for a better description of sugar + # @see Backticks::Runner for more control over process invocation + def self.run(*sugar) + command = self.new(*sugar) command.join command.captured_output end - # Run a command; return its success or failure. + # Run a command; return whether it succeeded or failed. # - # @param [String] cmd + # @param [Array] sugar list of command words and options # @return [Boolean] true if the command succeeded; false otherwise - def self.system(*cmd) - command = self.new(*cmd) + # @see Backticks::Runner#run for a better description of sugar + # @see Backticks::Runner for more control over process invocation + def self.system(*sugar) + command = self.new(*sugar) command.join $?.success? end end