Module: TuiTui::Command

Defined in:
lib/tui_tui/command.rb

Overview

One-shot instructions an app returns from update alongside its next state: [app, *commands]. The Runtime performs them before rendering.

Defined Under Namespace

Classes: Copy, Invalidate

Constant Summary collapse

ALL =

The canonical list of known commands; add new command types here.

[Copy, Invalidate].freeze

Class Method Summary collapse

Class Method Details

.validate!(command) ⇒ Object

Raises:

  • (ArgumentError)


15
16
17
18
19
# File 'lib/tui_tui/command.rb', line 15

def self.validate!(command)
  return if ALL.any? { |type| command.is_a?(type) }

  raise ArgumentError, "tui_tui: unknown command #{command.inspect}"
end