Class: Gm::Notepad::InputHandlers::HelpHandler
- Inherits:
-
DefaultHandler
- Object
- DefaultHandler
- Gm::Notepad::InputHandlers::HelpHandler
- Defined in:
- lib/gm/notepad/input_handlers/help_handler.rb
Constant Summary collapse
- HELP_PREFIX =
'?'.freeze
Class Method Summary collapse
Instance Method Summary collapse
Methods inherited from DefaultHandler
build_if_handled, #initialize, #lines
Constructor Details
This class inherits a constructor from Gm::Notepad::InputHandlers::DefaultHandler
Class Method Details
.handles?(input:) ⇒ Boolean
8 9 10 11 |
# File 'lib/gm/notepad/input_handlers/help_handler.rb', line 8 def self.handles?(input:) return false unless input.match(/^\?/) true end |
Instance Method Details
#after_initialize! ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/gm/notepad/input_handlers/help_handler.rb', line 13 def after_initialize! [ "Prefixes:", "\t? - Help (this command)", "\t+ - Query table names and contents", "\t<table_name: - Write the results to the given table", "\t` - Shell out command and write to interactive buffer", "\t`> - Shell out command and write to interactive AND output buffer", "", "Tokens:", "\t! - Skip expansion", "\t/search/ - Grep for the given 'search' within the prefix", "\t[index] - Target a specific 'index'", "\t[][column] - Pick a random index", "\t{table_name} - expand_line the given 'table_name'", "\t{table_name[d6]} - roll a d6 and lookup that row on the given 'table_name'", "\t{table_name[d6][name]} - pick a random row (between 1 and 6) and select the 'name' column from the given table_name" ].each do |text| input.for_rendering(text: text, to_interactive: true, to_output: false, expand_line: false) end end |