class Pytty::Client::ProcessYield

Attributes

id[R]

Public Class Methods

from_json(json) click to toggle source
# File lib/pytty/client/process_yield.rb, line 14
def self.from_json(json)
  self.new({
    id: json.fetch("id"),
    cmd: json.fetch("cmd"),
    env: json.fetch("env"),
    pid: json.fetch("pid"),
    status: json.fetch("status")
  })
end
new(id:, cmd:, env:, pid:, status:) click to toggle source
# File lib/pytty/client/process_yield.rb, line 4
def initialize(id:, cmd:, env:, pid:, status:)
  @cmd = cmd
  @env = env
  @pid = pid
  @id = id
  @status = status
end

Public Instance Methods

attach(interactive:) click to toggle source
# File lib/pytty/client/process_yield.rb, line 45
def attach(interactive:)
  Pytty::Client::Api::Attach.run id: @id, interactive: interactive
end
rm() click to toggle source
# File lib/pytty/client/process_yield.rb, line 37
def rm
  Pytty::Client::Api::Rm.run id: @id
end
running?() click to toggle source
# File lib/pytty/client/process_yield.rb, line 24
def running?
  !@pid.nil?
end
spawn(tty:, interactive:) click to toggle source
# File lib/pytty/client/process_yield.rb, line 41
def spawn(tty:, interactive:)
  Pytty::Client::Api::Spawn.run id: @id, tty: tty, interactive: interactive
end
to_s() click to toggle source
# File lib/pytty/client/process_yield.rb, line 28
def to_s
  fields = []
  fields << @id
  fields << running?
  fields << @status
  fields << @cmd.join(" ")
  fields.join("\t")
end