Class: Gm::Notepad::InputProcessor
- Inherits:
-
Object
- Object
- Gm::Notepad::InputProcessor
- Defined in:
- lib/gm/notepad/input_processor.rb
Overview
Responsible for processing the given input into a renderable state
Instance Attribute Summary collapse
-
#input_handler_registry ⇒ Object
writeonly
Sets the attribute input_handler_registry.
-
#table_registry ⇒ Object
readonly
Returns the value of attribute table_registry.
Instance Method Summary collapse
-
#initialize(table_registry:, **config) ⇒ InputProcessor
constructor
A new instance of InputProcessor.
- #process(input:) ⇒ Object
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
17 18 19 |
# File 'lib/gm/notepad/input_processor.rb', line 17 def input_handler_registry=(value) @input_handler_registry = value end |
#table_registry ⇒ Object
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 |