Sha256: 7ce0833953c946db0c16739fc48c7ab9e7b5fbcba061678f873b3e4555f4cb68

Contents?: true

Size: 558 Bytes

Versions: 2

Compression:

Stored size: 558 Bytes

Contents

module WhoAmI
  module Function
    class RemoveAnnotation
      def call(file_contents:)
        if file_contents !~ /\A# == Schema Info/
          return file_contents
        end

        keep_the_rest = false

        kept_lines =
          file_contents.lines.keep_if do |line|
            if keep_the_rest
              next true
            elsif line[0] == "#"
              next false
            else
              keep_the_rest = true
              next false
            end
          end

        kept_lines.join("")
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
who_am_i-0.0.2 lib/who_am_i/function/remove_annotation.rb
who_am_i-0.0.1 lib/who_am_i/function/remove_annotation.rb