Class: AnnotateRb::ModelAnnotator::Annotation::SchemaHeader
- Inherits:
-
Components::Base
- Object
- Components::Base
- AnnotateRb::ModelAnnotator::Annotation::SchemaHeader
- Defined in:
- lib/annotate_rb/model_annotator/annotation/schema_header.rb
Defined Under Namespace
Classes: DatabaseName, TableName
Instance Attribute Summary collapse
-
#database_name ⇒ Object
readonly
Returns the value of attribute database_name.
-
#table_comment ⇒ Object
readonly
Returns the value of attribute table_comment.
-
#table_name ⇒ Object
readonly
Returns the value of attribute table_name.
Instance Method Summary collapse
- #body ⇒ Object
-
#initialize(table_name, table_comment, database_name, options) ⇒ SchemaHeader
constructor
A new instance of SchemaHeader.
- #to_default ⇒ Object
- #to_markdown ⇒ Object
Methods inherited from Components::Base
Constructor Details
#initialize(table_name, table_comment, database_name, options) ⇒ SchemaHeader
Returns a new instance of SchemaHeader.
41 42 43 44 45 46 |
# File 'lib/annotate_rb/model_annotator/annotation/schema_header.rb', line 41 def initialize(table_name, table_comment, database_name, ) @table_name = table_name @table_comment = table_comment @database_name = database_name @options = end |
Instance Attribute Details
#database_name ⇒ Object (readonly)
Returns the value of attribute database_name.
39 40 41 |
# File 'lib/annotate_rb/model_annotator/annotation/schema_header.rb', line 39 def database_name @database_name end |
#table_comment ⇒ Object (readonly)
Returns the value of attribute table_comment.
39 40 41 |
# File 'lib/annotate_rb/model_annotator/annotation/schema_header.rb', line 39 def table_comment @table_comment end |
#table_name ⇒ Object (readonly)
Returns the value of attribute table_name.
39 40 41 |
# File 'lib/annotate_rb/model_annotator/annotation/schema_header.rb', line 39 def table_name @table_name end |
Instance Method Details
#body ⇒ Object
48 49 50 51 52 53 54 55 |
# File 'lib/annotate_rb/model_annotator/annotation/schema_header.rb', line 48 def body [ Components::BlankCommentLine.new, TableName.new(name), (DatabaseName.new(database_name) if database_name), Components::BlankCommentLine.new ].compact end |
#to_default ⇒ Object
57 58 59 |
# File 'lib/annotate_rb/model_annotator/annotation/schema_header.rb', line 57 def to_default body.map(&:to_default).join("\n") end |
#to_markdown ⇒ Object
61 62 63 |
# File 'lib/annotate_rb/model_annotator/annotation/schema_header.rb', line 61 def to_markdown body.map(&:to_markdown).join("\n") end |