Class: AnnotateRb::ModelAnnotator::Annotation::MarkdownHeader
- Inherits:
-
Components::Base
- Object
- Components::Base
- AnnotateRb::ModelAnnotator::Annotation::MarkdownHeader
- Defined in:
- lib/annotate_rb/model_annotator/annotation/markdown_header.rb
Constant Summary collapse
- MD_NAMES_OVERHEAD =
6
- MD_TYPE_ALLOWANCE =
18
Instance Attribute Summary collapse
-
#max_size ⇒ Object
readonly
Returns the value of attribute max_size.
Instance Method Summary collapse
-
#initialize(max_size) ⇒ MarkdownHeader
constructor
A new instance of MarkdownHeader.
- #to_default ⇒ Object
- #to_markdown ⇒ Object
Methods inherited from Components::Base
Constructor Details
#initialize(max_size) ⇒ MarkdownHeader
Returns a new instance of MarkdownHeader.
12 13 14 |
# File 'lib/annotate_rb/model_annotator/annotation/markdown_header.rb', line 12 def initialize(max_size) @max_size = max_size end |
Instance Attribute Details
#max_size ⇒ Object (readonly)
Returns the value of attribute max_size.
10 11 12 |
# File 'lib/annotate_rb/model_annotator/annotation/markdown_header.rb', line 10 def max_size @max_size end |
Instance Method Details
#to_default ⇒ Object
33 34 35 |
# File 'lib/annotate_rb/model_annotator/annotation/markdown_header.rb', line 33 def to_default nil end |
#to_markdown ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/annotate_rb/model_annotator/annotation/markdown_header.rb', line 16 def to_markdown name_padding = max_size + MD_NAMES_OVERHEAD # standard:disable Lint/FormatParameterMismatch formatted_headers = format("# %-#{name_padding}.#{name_padding}s | %-#{MD_TYPE_ALLOWANCE}.#{MD_TYPE_ALLOWANCE}s | %s", "Name", "Type", "Attributes") # standard:enable Lint/FormatParameterMismatch <<~HEADER.strip # ### Columns # #{formatted_headers} # #{"-" * name_padding} | #{"-" * MD_TYPE_ALLOWANCE} | #{"-" * 27} HEADER end |