Sha256: 86971fefbb6cdbb8b2ea65bbc142521234507ff7aae34b2f93386523f619cace

Contents?: true

Size: 462 Bytes

Versions: 4

Compression:

Stored size: 462 Bytes

Contents

# frozen_string_literal: true

module Pragmater
  module Processors
    # Handles the insertion or removal of pragma comments.
    class Handler
      DEFAULTS = {insert: Inserter, remove: Remover}.freeze

      def initialize processors: DEFAULTS
        @processors = processors
      end

      def call action, comments, body
        processors.fetch(action).new(comments, body).call
      end

      private

      attr_reader :processors
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
pragmater-9.3.0 lib/pragmater/processors/handler.rb
pragmater-9.2.0 lib/pragmater/processors/handler.rb
pragmater-9.1.2 lib/pragmater/processors/handler.rb
pragmater-9.1.1 lib/pragmater/processors/handler.rb