class GraphQL::Upgrader::RemoveExcessWhitespaceTransform

Remove redundant newlines, which may have trailing spaces Remove double newline after `do` Remove double newline before `end` Remove lines with whitespace only

Public Instance Methods

apply(input_text) click to toggle source
# File lib/graphql/upgrader/member.rb, line 753
def apply(input_text)
  input_text
    .gsub(/\n{3,}/m, "\n\n")
    .gsub(/do\n{2,}/m, "do\n")
    .gsub(/\n{2,}(\s*)end/m, "\n\\1end")
    .gsub(/\n +\n/m, "\n\n")
end