Method: Transloadit::Step#use

Defined in:
lib/transloadit/step.rb

#use(input) ⇒ String, ...

Specifies that this Step should process the provided input instead of the output of the Step before it.

Parameters:

  • input (Step, Array<Step>, Symbol, nil)

    The input step to use. Follows the conventions outlined in the online documentation. The symbol :original specifies that the original file should be sent to the robot. A Step indicates that this Step’s output should be used as the input to this one. Likewise, an array of Steps tells Transloadit to use pass each of their outputs to this Step. And lastly, an explicit nil clears the setting and restores it to its default input.

Returns:

  • (String, Array<String>, nil)

    The value for the :use parameter that will actually be sent to the REST API.



51
52
53
54
55
56
57
58
59
# File 'lib/transloadit/step.rb', line 51

def use(input)
  options.delete(:use) && return if input.nil?

  options[:use] = case input
  when Symbol then input.inspect
  when Array then input.map { |i| i.name }
  else [input.name]
  end
end