Sha256: ae46a436dfab9964fe242ce45c415cfaa547143d0ecf337bfb936950dd7cba84

Contents?: true

Size: 701 Bytes

Versions: 5

Compression:

Stored size: 701 Bytes

Contents

# frozen_string_literal: true

module AnnotateRb
  module ModelAnnotator
    class AnnotationPatternGenerator
      COMPAT_PREFIX = "== Schema Info"
      COMPAT_PREFIX_MD = "## Schema Info"

      class << self
        def call(options = Options.from({}))
          if options[:wrapper_open]
            return /(?:^(\n|\r\n)?# (?:#{options[:wrapper_open]}).*(\n|\r\n)?# (?:#{COMPAT_PREFIX}|#{COMPAT_PREFIX_MD}).*?(\n|\r\n)(#.*(\n|\r\n))*(\n|\r\n)*)|^(\n|\r\n)?# (?:#{COMPAT_PREFIX}|#{COMPAT_PREFIX_MD}).*?(\n|\r\n)(#.*(\n|\r\n))*(\n|\r\n)*/
          end
          /^(\n|\r\n)?# (?:#{COMPAT_PREFIX}|#{COMPAT_PREFIX_MD}).*?(\n|\r\n)(#.*(\n|\r\n))*(\n|\r\n)*/o
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
annotaterb-4.4.1 lib/annotate_rb/model_annotator/annotation_pattern_generator.rb
annotaterb-4.4.0 lib/annotate_rb/model_annotator/annotation_pattern_generator.rb
annotaterb-4.3.1 lib/annotate_rb/model_annotator/annotation_pattern_generator.rb
annotaterb-4.3.0 lib/annotate_rb/model_annotator/annotation_pattern_generator.rb
annotaterb-4.2.0 lib/annotate_rb/model_annotator/annotation_pattern_generator.rb