Sha256: ec608e1c0eadfab3f3bac5589ca9263ee8e85fcff6461ee660cff0fdf81877f3

Contents?: true

Size: 664 Bytes

Versions: 5

Compression:

Stored size: 664 Bytes

Contents

require 'gm/notepad/configuration'
module Gm
  module Notepad
    # Responsible for processing the given input into a renderable state
    class InputProcessor
      Configuration.init!(target: self, from_config: [:table_registry, :input_handler_registry])

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

      private

      def build_for(input:)
        input = input.to_s.strip
        handler = input_handler_registry.handler_for(input: input)
        handler.table_registry = table_registry
        handler
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
gm-notepad-0.0.10 lib/gm/notepad/input_processor.rb
gm-notepad-0.0.9 lib/gm/notepad/input_processor.rb
gm-notepad-0.0.8 lib/gm/notepad/input_processor.rb
gm-notepad-0.0.6 lib/gm/notepad/input_processor.rb
gm-notepad-0.0.5 lib/gm/notepad/input_processor.rb