Module: ActiveRecord::SaneSchemaDumper::Extension
- Extended by:
- ActiveSupport::Concern
- Defined in:
- lib/active_record/sane_schema_dumper/extension.rb
Instance Method Summary collapse
Instance Method Details
#table_with_sane_alignment(table, main_stream) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/active_record/sane_schema_dumper/extension.rb', line 10 def table_with_sane_alignment(table, main_stream) # Call the original method to populate our custom stream stream = StringIO.new table_without_sane_alignment(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 |