Class: Gm::Notepad::InputHandlers::HelpHandler

Inherits:
DefaultHandler show all
Defined in:
lib/gm/notepad/input_handlers/help_handler.rb

Constant Summary collapse

HELP_PREFIX =
'?'.freeze

Instance Attribute Summary

Attributes inherited from DefaultHandler

#expand_line, #input, #table_registry, #to_filesystem, #to_interactive, #to_output

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from DefaultHandler

build_if_handled, #each_line_with_parameters, #initialize

Constructor Details

This class inherits a constructor from Gm::Notepad::InputHandlers::DefaultHandler

Class Method Details

.handles?(input:) ⇒ Boolean

Returns:

  • (Boolean)


8
9
10
11
# File 'lib/gm/notepad/input_handlers/help_handler.rb', line 8

def self.handles?(input:)
  return false unless input[0] == HELP_PREFIX
  true
end

Instance Method Details

#after_initialize!Object



13
14
15
16
17
# File 'lib/gm/notepad/input_handlers/help_handler.rb', line 13

def after_initialize!
  self.to_interactive = true
  self.to_output = false
  self.expand_line = false
end

#linesObject



19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/gm/notepad/input_handlers/help_handler.rb', line 19

def lines
  [
    "Prefixes:",
    "\t? - Help (this command)",
    "\t+ - Query table names and contents",
    "\t<table_name: - Write the results to the given table",
    "",
    "Tokens:",
    "\t! - Skip expansion",
    "\t/search/ - Grep for the given 'search' within the prefix",
    "\t[index] - Target a specific 'index'",
    "\t{table_name} - expand_line the given 'table_name'"
  ]
end