Class: RBatch::CmdResult

Inherits:
Object
  • Object
show all
Defined in:
lib/rbatch/cmd.rb

Overview

Result of external command wrapper

Instance Attribute Summary (collapse)

Instance Method Summary (collapse)

Constructor Details

- (CmdResult) initialize(stdout_file, stderr_file, status, cmd_str)

Returns a new instance of CmdResult



94
95
96
97
98
99
# File 'lib/rbatch/cmd.rb', line 94

def initialize(stdout_file, stderr_file, status, cmd_str)
  @stdout_file = stdout_file
  @stderr_file = stderr_file
  @status = status
  @cmd_str = cmd_str
end

Instance Attribute Details

- (String) cmd_str (readonly)

Command string

Returns:

  • (String)


91
92
93
# File 'lib/rbatch/cmd.rb', line 91

def cmd_str
  @cmd_str
end

- (Integer) status (readonly)

Exit status

Returns:

  • (Integer)


87
88
89
# File 'lib/rbatch/cmd.rb', line 87

def status
  @status
end

- (File) stderr_file (readonly)

Tmp file including STDERROR String

Returns:

  • (File)


83
84
85
# File 'lib/rbatch/cmd.rb', line 83

def stderr_file
  @stderr_file
end

- (File) stdout_file (readonly)

Tmp file including STDOUT String

Returns:

  • (File)


79
80
81
# File 'lib/rbatch/cmd.rb', line 79

def stdout_file
  @stdout_file
end

Instance Method Details

- (String) stderr

STDERR String

Returns:

  • (String)


109
110
111
# File 'lib/rbatch/cmd.rb', line 109

def stderr
  File.read(@stderr_file)
end

- (String) stdout

STDOUT String

Returns:

  • (String)


103
104
105
# File 'lib/rbatch/cmd.rb', line 103

def stdout
  File.read(@stdout_file)
end

- (Hash) to_h

Return hash including cmd_str, std_out, std_err, and status

Returns:

  • (Hash)


115
116
117
# File 'lib/rbatch/cmd.rb', line 115

def to_h
  {:cmd_str => @cmd_str,:stdout => stdout, :stderr => stderr, :status => status}
end

- (String) to_s

Return string including cmd_str, std_out, std_err, and status

Returns:

  • (String)


121
122
123
# File 'lib/rbatch/cmd.rb', line 121

def to_s
  to_h.to_s
end