Class: Everywhere::Dock::Info
- Inherits:
-
Dock
- Object
- Dock
- Everywhere::Dock::Info
- Defined in:
- lib/everywhere/dock/info.rb
Overview
The pinned footer for every preview.
Same machinery as the dev dock — it owns the terminal through Console and repaints around every write (see Dock::Screen) — but what it pins is a handful of facts rather than a set of running targets: the share link, the URL to type in by hand and the pairing token. Preview prints those once and then relays the dev server's log, which used to bury them within seconds; the whole point of the command is that someone can still see how to connect five minutes in.
It carries no state of its own to spin, so the base class's ticker only ever redraws it on a resize.
Defined Under Namespace
Classes: Null
Constant Summary collapse
- KEYS =
[ ["s", "show the QR"], ["r", "restart server"], ["q", "quit"] ].freeze
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(items = [], io: $stdout, keys: true, size: nil) ⇒ Info
constructor
A new instance of Info.
-
#keys? ⇒ Boolean
Whether the keymap in the footer is a promise we can keep — the caller owns the key loop, so it has to know whether to read stdin at all.
-
#show(items) ⇒ Object
Replace the facts and repaint now.
Constructor Details
#initialize(items = [], io: $stdout, keys: true, size: nil) ⇒ Info
Returns a new instance of Info.
32 33 34 35 |
# File 'lib/everywhere/dock/info.rb', line 32 def initialize(items = [], io: $stdout, keys: true, size: nil) super([], io: io, keys: keys, size: size) @items = items end |
Class Method Details
Instance Method Details
#keys? ⇒ Boolean
Whether the keymap in the footer is a promise we can keep — the caller owns the key loop, so it has to know whether to read stdin at all.
39 |
# File 'lib/everywhere/dock/info.rb', line 39 def keys? = @keys |
#show(items) ⇒ Object
Replace the facts and repaint now. A quick tunnel that dropped comes back on a different hostname, so the footer must not outlive its URL.
43 44 45 46 47 |
# File 'lib/everywhere/dock/info.rb', line 43 def show(items) @items = items @dirty = true refresh end |