class CodeKindly::Utils::Command

Attributes

command[R]

Public Class Methods

new(command) click to toggle source
# File lib/code_kindly/utils/command.rb, line 16
def initialize(command)
  @command = command
end
run(command) click to toggle source
# File lib/code_kindly/utils/command.rb, line 9
def run(command)
  new(command).run
end

Public Instance Methods

result() click to toggle source
# File lib/code_kindly/utils/command.rb, line 28
def result
  return nil if blank? @std_out
  @std_out.chomp!
  blank? @std_out ? nil : @std_out
end
run() click to toggle source
# File lib/code_kindly/utils/command.rb, line 20
def run
  require 'open3'
  command = @command
  command.join(' ') if command.is_a?(Array)
  @std_in, @std_out, @std_err = Open3.capture3(command)
  self
end