Class: Xshellz::ProcessInfo

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

Overview

One process row from Sandbox#procs.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Attribute Details

#commObject

Returns the value of attribute comm

Returns:

  • (Object)

    the current value of comm



101
102
103
# File 'lib/xshellz/models.rb', line 101

def comm
  @comm
end

#cpuObject

Returns the value of attribute cpu

Returns:

  • (Object)

    the current value of cpu



101
102
103
# File 'lib/xshellz/models.rb', line 101

def cpu
  @cpu
end

#memObject

Returns the value of attribute mem

Returns:

  • (Object)

    the current value of mem



101
102
103
# File 'lib/xshellz/models.rb', line 101

def mem
  @mem
end

#pidObject

Returns the value of attribute pid

Returns:

  • (Object)

    the current value of pid



101
102
103
# File 'lib/xshellz/models.rb', line 101

def pid
  @pid
end

Class Method Details

.from_api(payload) ⇒ Object



102
103
104
105
106
107
108
109
110
# File 'lib/xshellz/models.rb', line 102

def self.from_api(payload)
  payload ||= {}
  new(
    pid: (payload["pid"] || 0).to_i,
    comm: payload["comm"].to_s,
    cpu: (payload["cpu"] || 0.0).to_f,
    mem: (payload["mem"] || 0.0).to_f
  )
end