Class: Slk::Models::StatusSnapshot
- Inherits:
-
Data
- Object
- Data
- Slk::Models::StatusSnapshot
- Defined in:
- lib/slk/models/status_snapshot.rb
Overview
Everything slk status knows about one workspace at one moment: the
status itself, plus the two things that decide whether anyone can reach
you (presence, DND) and whatever is queued to replace the status later.
Every part but the status is optional, and nil means "not checked" —
skipped by a flag, or a lookup that failed. That is deliberately distinct
from checked-and-empty: scheduled: [] says nothing is queued, while
scheduled: nil says nobody looked.
Instance Attribute Summary collapse
-
#dnd ⇒ Object
readonly
Returns the value of attribute dnd.
-
#presence ⇒ Object
readonly
Returns the value of attribute presence.
-
#scheduled ⇒ Object
readonly
Returns the value of attribute scheduled.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
-
#workspace ⇒ Object
readonly
Returns the value of attribute workspace.
Instance Method Summary collapse
- #away? ⇒ Boolean
-
#initialize(workspace:, status:, presence: nil, dnd: nil, scheduled: nil) ⇒ StatusSnapshot
constructor
A new instance of StatusSnapshot.
-
#labels ⇒ Object
Short suffixes for the status line.
- #workspace_name ⇒ Object
Constructor Details
#initialize(workspace:, status:, presence: nil, dnd: nil, scheduled: nil) ⇒ StatusSnapshot
Returns a new instance of StatusSnapshot.
14 15 16 |
# File 'lib/slk/models/status_snapshot.rb', line 14 def initialize(workspace:, status:, presence: nil, dnd: nil, scheduled: nil) super end |
Instance Attribute Details
#dnd ⇒ Object (readonly)
Returns the value of attribute dnd
13 14 15 |
# File 'lib/slk/models/status_snapshot.rb', line 13 def dnd @dnd end |
#presence ⇒ Object (readonly)
Returns the value of attribute presence
13 14 15 |
# File 'lib/slk/models/status_snapshot.rb', line 13 def presence @presence end |
#scheduled ⇒ Object (readonly)
Returns the value of attribute scheduled
13 14 15 |
# File 'lib/slk/models/status_snapshot.rb', line 13 def scheduled @scheduled end |
#status ⇒ Object (readonly)
Returns the value of attribute status
13 14 15 |
# File 'lib/slk/models/status_snapshot.rb', line 13 def status @status end |
#workspace ⇒ Object (readonly)
Returns the value of attribute workspace
13 14 15 |
# File 'lib/slk/models/status_snapshot.rb', line 13 def workspace @workspace end |
Instance Method Details
#away? ⇒ Boolean
20 |
# File 'lib/slk/models/status_snapshot.rb', line 20 def away? = presence ? presence[:presence] == 'away' : false |
#labels ⇒ Object
Short suffixes for the status line. Only the exceptional states appear: active presence and DND-off are the common case, and repeating them on every line would bury the workspace that differs.
25 26 27 |
# File 'lib/slk/models/status_snapshot.rb', line 25 def labels [('[away]' if away?), dnd&.to_s].reject { |label| label.to_s.empty? } end |
#workspace_name ⇒ Object
18 |
# File 'lib/slk/models/status_snapshot.rb', line 18 def workspace_name = workspace.name |