Module: Ukiryu::Redirection

Defined in:
lib/ukiryu/io.rb

Overview

File redirection primitives

Provides utilities for file redirection operations

Class Method Summary collapse

Class Method Details

.stderr_to_stdoutHash

Redirect stderr to stdout (2>&1 in shell)

Examples:

Redirection.stderr_to_stdout

Returns:

  • (Hash)

    redirection specification



129
130
131
# File 'lib/ukiryu/io.rb', line 129

def self.stderr_to_stdout
  { stderr: :stdout }
end

.to(stream, path) ⇒ Hash

Redirect output to a file

Examples:

Redirection.to(:stdout, "/tmp/output.txt")

Parameters:

  • output (Symbol, String)

    :stdout or :stderr

  • path (String)

    the file path to redirect to

Returns:

  • (Hash)

    redirection specification



119
120
121
# File 'lib/ukiryu/io.rb', line 119

def self.to(stream, path)
  { stream => path }
end