class RatatuiRuby::Event::None

Null object for absent events.

Event loops poll for input 60 times per second. Usually nothing is happening. If RatatuiRuby.poll_event returned nil, you would need nil-checks: event&.key?, next unless event.

This class eliminates that friction. It responds to every predicate with false. Call none? to detect it explicitly. Pattern-match on type: :none for exhaustive dispatch.

Use it to simplify your event loop. No guards. Optional ‘else` clauses.

See Martin Fowler’s Special Case pattern.

Predicate Example

event = RatatuiRuby.poll_event
break if event.ctrl_c?
redraw if event.none?

Pattern Matching Example

redraw if RatatuiRuby.poll_event in type: :none