class

Scroll::Sorter

Inherits Reference < Object

Reorders the retained tail window for STDERR display only. It is applied between tail.snapshot and renderer.draw, and never touches STDOUT or the Tail's input-order invariants.

Design note (plan alignment): under sorting the tool's normal "never slow STDOUT" priority is intentionally relaxed. STDOUT, when present, is still an input-order passthrough (byte identity preserved) — it is just no longer the performance priority while the display is being sorted over the full window. The headline use case is sort + --file/-f follow with no STDOUT at all.

Constructors

new(sort : Bool, reverse : Bool, human : Bool, sort_by : SortKey | Nil)
Source

Instance methods

key(line : String) : HumanKey

The comparable key for one line, exposed so SortWindow can track the top-N without re-implementing key extraction. --reverse is not baked in here — callers apply it to the comparison.

Source
order(lines : Array(String)) : Array(String)

Reorder for display only. Returns the same array (identity) when no ordering is requested, so the common path adds zero overhead.

Source
reverse?
Source