module ActiveRecord::SaneSchemaDumper::Extension

Public Instance Methods

table(table, main_stream) click to toggle source
Calls superclass method
# File lib/active_record/sane_schema_dumper/extension.rb, line 4
def table(table, main_stream)
  # Call the original method to populate our custom stream
  stream = StringIO.new
  super(table, stream)

  # Rewind the stream and remove useless whitespace
  content = stream.tap(&:rewind).read.gsub(/(?<!^)(?<!\s)[ ]{2,}/, ' ')
  main_stream.print(content)

  # Rails expects the `#table` method to return the main stream
  main_stream
end