Class: AnnotateRb::ModelAnnotator::Annotation::SchemaHeader

Inherits:
Components::Base show all
Defined in:
lib/annotate_rb/model_annotator/annotation/schema_header.rb

Defined Under Namespace

Classes: TableName

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Components::Base

#to_rdoc, #to_yard

Constructor Details

#initialize(table_name, table_comment, options) ⇒ SchemaHeader

Returns a new instance of SchemaHeader.



25
26
27
28
29
# File 'lib/annotate_rb/model_annotator/annotation/schema_header.rb', line 25

def initialize(table_name, table_comment, options)
  @table_name = table_name
  @table_comment = table_comment
  @options = options
end

Instance Attribute Details

#table_commentObject (readonly)

Returns the value of attribute table_comment.



23
24
25
# File 'lib/annotate_rb/model_annotator/annotation/schema_header.rb', line 23

def table_comment
  @table_comment
end

#table_nameObject (readonly)

Returns the value of attribute table_name.



23
24
25
# File 'lib/annotate_rb/model_annotator/annotation/schema_header.rb', line 23

def table_name
  @table_name
end

Instance Method Details

#bodyObject



31
32
33
34
35
36
37
# File 'lib/annotate_rb/model_annotator/annotation/schema_header.rb', line 31

def body
  [
    Components::BlankCommentLine.new,
    TableName.new(name),
    Components::BlankCommentLine.new
  ]
end

#to_defaultObject



39
40
41
# File 'lib/annotate_rb/model_annotator/annotation/schema_header.rb', line 39

def to_default
  body.map(&:to_default).join("\n")
end

#to_markdownObject



43
44
45
# File 'lib/annotate_rb/model_annotator/annotation/schema_header.rb', line 43

def to_markdown
  body.map(&:to_markdown).join("\n")
end