Class: ShellCommand::Command

Inherits:
Struct
  • Object
show all
Defined in:
lib/shell_command.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method, *args, &block) ⇒ Object



21
22
23
24
25
26
27
# File 'lib/shell_command.rb', line 21

def method_missing method, *args, &block
  if status.respond_to?(method)
    status.send(method, *args, &block)
  else
    super
  end
end

Instance Attribute Details

#statusProcess::Status

The status of the command.

Returns:

  • (Process::Status)

    the current value of status



19
20
21
# File 'lib/shell_command.rb', line 19

def status
  @status
end

#stderrString

The output written by the command to standard error.

Returns:

  • (String)

    the current value of stderr



19
20
21
# File 'lib/shell_command.rb', line 19

def stderr
  @stderr
end

#stdoutString

The output written by the command to standard output.

Returns:

  • (String)

    the current value of stdout



19
20
21
# File 'lib/shell_command.rb', line 19

def stdout
  @stdout
end

Instance Method Details

#respond_to_missing?(method, include_private = false) ⇒ Boolean

Returns:

  • (Boolean)


29
30
31
# File 'lib/shell_command.rb', line 29

def respond_to_missing? method, include_private = false
  status.respond_to?(method, include_private)
end