Sha256: 751be22bdda2795d0cc2aee7bb76030589e3c7de76563a2e6e8a606d1a9b0b8c
Contents?: true
Size: 619 Bytes
Versions: 32
Compression:
Stored size: 619 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 filter comments Array(comments).select { |comment| comment =~ formatter.valid_formats } end def format comments filter(comments).map { |comment| formatter.new(comment).format } end end end
Version data entries
32 entries across 32 versions & 1 rubygems