Class: SchemaPlus::Core::SchemaDump::Table::Column
- Inherits:
-
Struct
- Object
- Struct
- SchemaPlus::Core::SchemaDump::Table::Column
- Defined in:
- lib/schema_plus/core/schema_dump.rb
Instance Attribute Summary collapse
-
#comments ⇒ Object
Returns the value of attribute comments.
-
#name ⇒ Object
Returns the value of attribute name.
-
#options ⇒ Object
Returns the value of attribute options.
-
#type ⇒ Object
Returns the value of attribute type.
Instance Method Summary collapse
Instance Attribute Details
#comments ⇒ Object
Returns the value of attribute comments
91 92 93 |
# File 'lib/schema_plus/core/schema_dump.rb', line 91 def comments @comments end |
#name ⇒ Object
Returns the value of attribute name
91 92 93 |
# File 'lib/schema_plus/core/schema_dump.rb', line 91 def name @name end |
#options ⇒ Object
Returns the value of attribute options
91 92 93 |
# File 'lib/schema_plus/core/schema_dump.rb', line 91 def end |
#type ⇒ Object
Returns the value of attribute type
91 92 93 |
# File 'lib/schema_plus/core/schema_dump.rb', line 91 def type @type end |
Instance Method Details
#assemble(stream, typelen, namelen) ⇒ Object
93 94 95 96 97 98 99 100 101 102 103 104 105 |
# File 'lib/schema_plus/core/schema_dump.rb', line 93 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 .to_s.sub(/^{(.*)}$/, '\1') unless .blank? stream.write ' ' unless .blank? or comments.blank? stream.write '# ' + comments.join('; ') unless comments.blank? end |