Class: AnnotateRb::ModelAnnotator::CheckConstraintAnnotation::Annotation
- Inherits:
-
Object
- Object
- AnnotateRb::ModelAnnotator::CheckConstraintAnnotation::Annotation
- Defined in:
- lib/annotate_rb/model_annotator/check_constraint_annotation/annotation.rb
Constant Summary collapse
- HEADER_TEXT =
"Check Constraints"
Instance Method Summary collapse
- #body ⇒ Object
-
#initialize(constraints) ⇒ Annotation
constructor
A new instance of Annotation.
- #to_default ⇒ Object
- #to_markdown ⇒ Object
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
#body ⇒ Object
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_default ⇒ Object
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_markdown ⇒ Object
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 |