Class: Fatty::AlertSession

Inherits:
Session
  • Object
show all
Defined in:
lib/fatty/session/alert_session.rb

Overview

A pinned, non-interactive overlay session responsible for rendering alerts.

It is intentionally dumb:

  • Terminal does not special-case alerts
  • other sessions emit commands like: [:send, :alert, :show, { level:, message: }] [:send, :alert, :clear, {}]

Instance Attribute Summary collapse

Attributes inherited from Session

#counter, #keymap, #terminal, #views

Instance Method Summary collapse

Methods inherited from Session

#add_view, #close, #handle_action, #handle_resize, #init, #inspect, #keymap_contexts, #persist!, #resolve_action, #tick, #update, #view

Methods included from Actionable

included

Constructor Details

#initializeAlertSession

Returns a new instance of AlertSession.



14
15
16
17
# File 'lib/fatty/session/alert_session.rb', line 14

def initialize
  super(views: [Fatty::AlertView.new(z: 1_000)])
  @current = nil
end

Instance Attribute Details

#currentObject (readonly)

Returns the value of attribute current.



12
13
14
# File 'lib/fatty/session/alert_session.rb', line 12

def current
  @current
end

Instance Method Details

#idObject



19
20
21
# File 'lib/fatty/session/alert_session.rb', line 19

def id
  :alert
end