Sha256: 672c646586eda842376ed68dbef57b57a4832008e12ff144693eab49e8aae2a8

Contents?: true

Size: 507 Bytes

Versions: 1

Compression:

Stored size: 507 Bytes

Contents

# frozen_string_literal: true

module Pragmater
  # Handles pragma comments.
  class Commenter
    def initialize older, newer, formatter: Formatter
      @formatter = formatter
      @older = format older
      @newer = format newer
    end

    def add
      older | newer
    end

    def remove
      older - (older & newer)
    end

    private

    attr_reader :older, :newer, :formatter

    def format comments
      Array(comments).map { |comment| formatter.new(comment).format }
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
pragmater-0.1.0 lib/pragmater/commenter.rb