Module: ActiveRecord::SaneSchemaDumper::Extension
- Defined in:
- lib/active_record/sane_schema_dumper/extension.rb
Instance Method Summary collapse
Instance Method Details
#table(table, main_stream) ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 |
# 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 |