Sha256: 03faccd89f384f0cd2793a1d0f4b1c2fd01f2516e4f3aabda144806f969be91a

Contents?: true

Size: 539 Bytes

Versions: 41

Compression:

Stored size: 539 Bytes

Contents

# frozen_string_literal: true

module Pragmater
  module Parsers
    # Manages pragma comments.
    class Comments
      def initialize older, newer, formatter: Formatters::Main
        @formatter = formatter
        @older = format older
        @newer = format newer
      end

      def insert = older.union(newer)

      def remove = older - older.intersection(newer)

      private

      attr_reader :formatter, :older, :newer

      def format(pragmas) = Array(pragmas).map { |pragma| formatter.new(pragma).call }
    end
  end
end

Version data entries

41 entries across 41 versions & 1 rubygems

Version Path
pragmater-16.0.0 lib/pragmater/parsers/comments.rb
pragmater-15.7.0 lib/pragmater/parsers/comments.rb
pragmater-15.6.0 lib/pragmater/parsers/comments.rb
pragmater-15.5.0 lib/pragmater/parsers/comments.rb
pragmater-15.4.0 lib/pragmater/parsers/comments.rb
pragmater-15.3.0 lib/pragmater/parsers/comments.rb
pragmater-15.2.0 lib/pragmater/parsers/comments.rb
pragmater-15.1.0 lib/pragmater/parsers/comments.rb
pragmater-15.0.0 lib/pragmater/parsers/comments.rb
pragmater-14.6.0 lib/pragmater/parsers/comments.rb
pragmater-14.4.0 lib/pragmater/parsers/comments.rb
pragmater-14.3.0 lib/pragmater/parsers/comments.rb
pragmater-14.2.0 lib/pragmater/parsers/comments.rb
pragmater-14.1.1 lib/pragmater/parsers/comments.rb
pragmater-14.1.0 lib/pragmater/parsers/comments.rb
pragmater-14.0.0 lib/pragmater/parsers/comments.rb
pragmater-13.2.1 lib/pragmater/parsers/comments.rb
pragmater-13.2.0 lib/pragmater/parsers/comments.rb
pragmater-13.1.0 lib/pragmater/parsers/comments.rb
pragmater-13.0.3 lib/pragmater/parsers/comments.rb