Class: Gm::Notepad::InputProcessor

Inherits:
Object
  • Object
show all
Defined in:
lib/gm/notepad/input_processor.rb

Overview

Responsible for processing the given input into a renderable state

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(table_registry:, **config) ⇒ InputProcessor

Returns a new instance of InputProcessor.



5
6
7
8
# File 'lib/gm/notepad/input_processor.rb', line 5

def initialize(table_registry:, **config)
  self.table_registry = table_registry
  self.input_handler_registry = config.fetch(:input_handler_registry) { default_input_handler_registry }
end

Instance Attribute Details

#input_handler_registry=(value) ⇒ Object

Sets the attribute input_handler_registry

Parameters:

  • value

    the value to set the attribute input_handler_registry to.



17
18
19
# File 'lib/gm/notepad/input_processor.rb', line 17

def input_handler_registry=(value)
  @input_handler_registry = value
end

#table_registryObject

Returns the value of attribute table_registry.



17
18
19
# File 'lib/gm/notepad/input_processor.rb', line 17

def table_registry
  @table_registry
end

Instance Method Details

#process(input:) ⇒ Object



10
11
12
13
14
15
# File 'lib/gm/notepad/input_processor.rb', line 10

def process(input:)
  processor = build_for(input: input)
  processor.each_line_with_parameters do |*args|
    yield(*args)
  end
end