Class: AnnotateRb::ModelAnnotator::CheckConstraintAnnotation::Annotation

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

Constant Summary collapse

HEADER_TEXT =
"Check Constraints"

Instance Method Summary collapse

Constructor Details

#initialize(constraints) ⇒ Annotation

Returns a new instance of Annotation.



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

def initialize(constraints)
  @constraints = constraints
end

Instance Method Details

#bodyObject



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

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

#to_defaultObject



26
27
28
# File 'lib/annotate_rb/model_annotator/check_constraint_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/check_constraint_annotation/annotation.rb', line 22

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