Class: SchemaPlus::Core::SchemaDump::Table::Column
- Inherits:
-
Object
- Object
- SchemaPlus::Core::SchemaDump::Table::Column
- Defined in:
- lib/schema_plus/core/schema_dump.rb
Instance Method Summary collapse
- #add_comment(comment) ⇒ Object
- #add_option(option) ⇒ Object
- #assemble(stream, typelen, namelen) ⇒ Object
Instance Method Details
#add_comment(comment) ⇒ Object
92 93 94 |
# File 'lib/schema_plus/core/schema_dump.rb', line 92 def add_comment(comment) self.comments = [comments, comment].reject(&:blank?).join('; ') end |
#add_option(option) ⇒ Object
88 89 90 |
# File 'lib/schema_plus/core/schema_dump.rb', line 88 def add_option(option) self. = [, option].reject(&:blank?).join(', ') end |
#assemble(stream, typelen, namelen) ⇒ Object
96 97 98 99 100 101 102 103 104 105 106 107 108 |
# File 'lib/schema_plus/core/schema_dump.rb', line 96 def assemble(stream, typelen, namelen) stream.write "t.%-#{typelen}s " % type if .blank? && comments.blank? stream.write name.inspect else pr = name.inspect pr += "," unless .blank? stream.write "%-#{namelen+3}s " % pr end stream.write "#{}" unless .blank? stream.write " " unless .blank? or comments.blank? stream.write "# #{comments}" unless comments.blank? end |