Class: AnnotateRb::ModelAnnotator::ForeignKeyAnnotation::Annotation

Inherits:
Object
  • Object
show all
Defined in:
lib/annotate_rb/model_annotator/foreign_key_annotation/annotation.rb

Constant Summary collapse

HEADER_TEXT =
"Foreign Keys"

Instance Method Summary collapse

Constructor Details

#initialize(foreign_keys) ⇒ Annotation

Returns a new instance of Annotation.



9
10
11
# File 'lib/annotate_rb/model_annotator/foreign_key_annotation/annotation.rb', line 9

def initialize(foreign_keys)
  @foreign_keys = foreign_keys
end

Instance Method Details

#bodyObject



13
14
15
16
17
18
19
20
# File 'lib/annotate_rb/model_annotator/foreign_key_annotation/annotation.rb', line 13

def body
  [
    Components::BlankCommentLine.new,
    Components::Header.new(HEADER_TEXT),
    Components::BlankCommentLine.new,
    *@foreign_keys
  ]
end

#to_defaultObject



26
27
28
# File 'lib/annotate_rb/model_annotator/foreign_key_annotation/annotation.rb', line 26

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

#to_markdownObject



22
23
24
# File 'lib/annotate_rb/model_annotator/foreign_key_annotation/annotation.rb', line 22

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