Class: Media::Command::Subshell

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/media/command/subshell.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(args) ⇒ Subshell

Returns a new instance of Subshell.



12
13
14
# File 'lib/media/command/subshell.rb', line 12

def initialize(args)
  @cmd = args.fetch(:cmd)
end

Instance Attribute Details

#errorObject (readonly)

Returns the value of attribute error.



10
11
12
# File 'lib/media/command/subshell.rb', line 10

def error
  @error
end

#outObject (readonly)

Returns the value of attribute out.



10
11
12
# File 'lib/media/command/subshell.rb', line 10

def out
  @out
end

#statusObject (readonly)

Returns the value of attribute status.



10
11
12
# File 'lib/media/command/subshell.rb', line 10

def status
  @status
end

Instance Method Details

#callObject



16
17
18
19
# File 'lib/media/command/subshell.rb', line 16

def call
  @out, @error, @status = Open3.capture3(@cmd)
  self
end

#success?Boolean

Returns:

  • (Boolean)


21
22
23
# File 'lib/media/command/subshell.rb', line 21

def success?
  exitstatus == 0
end