Sha256: ebfd629cc4f2ad46db46bcd613cb1e4752bc0658a11e3c766b8b9d1aa43b645f
Contents?: true
Size: 476 Bytes
Versions: 16
Compression:
Stored size: 476 Bytes
Contents
#!/usr/bin/env ruby -i # encoding: utf-8 # helpers def pass; end # main buffer = ARGF.inject(String.new) do |buffer, line| # line filters line.gsub!(/\s*\n$/, "\n") line.gsub!("'", '"') line.gsub!('u"', '"') if line =~ /^\s*# \[/ buffer += line end # buffer filters buffer.gsub!(/\n{2,}/m, "\n\n") pass while buffer.gsub!(/(\n( *) end)\n{2,}(\2end)/m, "\\1\n\\3") # Make sure there's only one \n at the end pass while buffer.chomp! buffer += "\n" puts buffer
Version data entries
16 entries across 16 versions & 1 rubygems