Sha256: da11139564ba4a7ae57dcb6e0b45225e76adad7254972be42b6435a56d3e8d02

Contents?: true

Size: 714 Bytes

Versions: 4

Compression:

Stored size: 714 Bytes

Contents

# frozen_string_literal: true

module AnnotateRb
  module ModelAnnotator
    class AnnotationPatternGenerator
      COMPAT_PREFIX = '== Schema Info'.freeze
      COMPAT_PREFIX_MD = '## Schema Info'.freeze

      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)*/
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
annotaterb-4.1.1 lib/annotate_rb/model_annotator/annotation_pattern_generator.rb
annotaterb-4.1.0 lib/annotate_rb/model_annotator/annotation_pattern_generator.rb
annotaterb-4.0.0 lib/annotate_rb/model_annotator/annotation_pattern_generator.rb
annotaterb-4.0.0.beta.1 lib/annotate_rb/model_annotator/annotation_pattern_generator.rb