Class: Xshellz::SandboxProcs
- Inherits:
-
Struct
- Object
- Struct
- Xshellz::SandboxProcs
- Defined in:
- lib/xshellz/models.rb
Overview
Top processes + session info for a running sandbox (+Sandbox#procs+).
procs is an Arraysessions counts active SSH sessions;
agents lists detected agent processes (e.g. "claude") by name.
Instance Attribute Summary collapse
-
#agents ⇒ Object
Returns the value of attribute agents.
-
#disk_allowed_mb ⇒ Object
Returns the value of attribute disk_allowed_mb.
-
#disk_used_mb ⇒ Object
Returns the value of attribute disk_used_mb.
-
#procs ⇒ Object
Returns the value of attribute procs.
-
#sessions ⇒ Object
Returns the value of attribute sessions.
Class Method Summary collapse
-
.from_api(payload) ⇒ Object
Build a
SandboxProcsfrom the API's JSON payload (tolerant of missing keys).
Instance Attribute Details
#agents ⇒ Object
Returns the value of attribute agents
117 118 119 |
# File 'lib/xshellz/models.rb', line 117 def agents @agents end |
#disk_allowed_mb ⇒ Object
Returns the value of attribute disk_allowed_mb
117 118 119 |
# File 'lib/xshellz/models.rb', line 117 def disk_allowed_mb @disk_allowed_mb end |
#disk_used_mb ⇒ Object
Returns the value of attribute disk_used_mb
117 118 119 |
# File 'lib/xshellz/models.rb', line 117 def disk_used_mb @disk_used_mb end |
#procs ⇒ Object
Returns the value of attribute procs
117 118 119 |
# File 'lib/xshellz/models.rb', line 117 def procs @procs end |
#sessions ⇒ Object
Returns the value of attribute sessions
117 118 119 |
# File 'lib/xshellz/models.rb', line 117 def sessions @sessions end |
Class Method Details
.from_api(payload) ⇒ Object
Build a SandboxProcs from the API's JSON payload (tolerant of
missing keys).
127 128 129 130 131 132 133 134 135 136 137 138 |
# File 'lib/xshellz/models.rb', line 127 def self.from_api(payload) payload ||= {} rows = payload["procs"] rows = [] unless rows.is_a?(Array) new( procs: rows.map { |row| ProcessInfo.from_api(row) }, sessions: (payload["sessions"] || 0).to_i, agents: Array(payload["agents"]).map(&:to_s), disk_used_mb: (payload["disk_used_mb"] || 0).to_i, disk_allowed_mb: (payload["disk_allowed_mb"] || 0).to_i ) end |