class GraphQL::Upgrader::RemoveNewlinesTransform
Remove newlines – normalize the text for processing
def apply(input_text)
def apply(input_text) keep_looking = true while keep_looking do keep_looking = false # Find the `field` call (or other method), and an open paren, but not a close paren, or a comma between arguments input_text = input_text.gsub(/(?<field>(?:field|input_field|return_field|connection|argument)(?:\([^)]*|.*,))\n\s*(?<next_line>.+)/) do keep_looking = true field = $~[:field].chomp next_line = $~[:next_line] "#{field} #{next_line}" end end input_text end