class Gm::Notepad::InputHandlers::WriteToTableHandler

Constants

WITH_WRITE_TARGET_REGEXP

Public Class Methods

handles?(input:) click to toggle source
# File lib/gm/notepad/input_handlers/write_to_table_handler.rb, line 8
def self.handles?(input:)
  return true if input.match(WITH_WRITE_TARGET_REGEXP)
end

Public Instance Methods

after_initialize!() click to toggle source
# File lib/gm/notepad/input_handlers/write_to_table_handler.rb, line 12
def after_initialize!
  match = input.match(WITH_WRITE_TARGET_REGEXP)
  input.text_to_evaluate = match[:line].strip
  table_name = match[:table_name]
  table_name = table_name.downcase
  input.for_rendering(
    table_name: table_name,
    text: input.text_to_evaluate,
    to_interactive: true,
    to_output: false,
    to_filesystem: true,
    expand_line: true
  )
end