Class: SchemaPlus::Core::SchemaDump::Table::Column

Inherits:
Object
  • Object
show all
Defined in:
lib/schema_plus/core/schema_dump.rb

Instance Method Summary collapse

Instance Method Details

#assemble(stream, typelen, namelen) ⇒ Object



90
91
92
93
94
95
96
97
98
99
100
101
102
# File 'lib/schema_plus/core/schema_dump.rb', line 90

def assemble(stream, typelen, namelen)
  stream.write "t.%-#{typelen}s " % type
  if options.blank? && comments.blank?
    stream.write name.inspect
  else
    pr = name.inspect
    pr += ',' unless options.blank?
    stream.write "%-#{namelen+3}s " % pr
  end
  stream.write options.to_s.sub(/^{(.*)}$/, '\1') unless options.blank?
  stream.write ' ' unless options.blank? or comments.blank?
  stream.write '# ' + comments.join('; ') unless comments.blank?
end