Sha256: 7f2b90724bf17de4c8c241f2ac81d1ac12862b71c33272e68e6860749f51321a

Contents?: true

Size: 486 Bytes

Versions: 6

Compression:

Stored size: 486 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

6 entries across 6 versions & 1 rubygems

Version Path
pragmater-9.1.0 lib/pragmater/processors/handler.rb
pragmater-9.0.0 lib/pragmater/processors/handler.rb
pragmater-8.3.0 lib/pragmater/processors/handler.rb
pragmater-8.2.0 lib/pragmater/processors/handler.rb
pragmater-8.1.0 lib/pragmater/processors/handler.rb
pragmater-8.0.0 lib/pragmater/processors/handler.rb