Class: AnnotateRb::ModelAnnotator::ForeignKeyAnnotation::ForeignKeyComponent
- Inherits:
-
Components::Base
- Object
- Components::Base
- AnnotateRb::ModelAnnotator::ForeignKeyAnnotation::ForeignKeyComponent
- Defined in:
- lib/annotate_rb/model_annotator/foreign_key_annotation/foreign_key_component.rb
Instance Attribute Summary collapse
-
#constraints_info ⇒ Object
readonly
Returns the value of attribute constraints_info.
-
#formatted_name ⇒ Object
readonly
Returns the value of attribute formatted_name.
-
#max_size ⇒ Object
readonly
Returns the value of attribute max_size.
-
#ref_info ⇒ Object
readonly
Returns the value of attribute ref_info.
Instance Method Summary collapse
-
#initialize(formatted_name, constraints_info, ref_info, max_size) ⇒ ForeignKeyComponent
constructor
A new instance of ForeignKeyComponent.
- #to_default ⇒ Object
- #to_markdown ⇒ Object
Methods inherited from Components::Base
Constructor Details
#initialize(formatted_name, constraints_info, ref_info, max_size) ⇒ ForeignKeyComponent
Returns a new instance of ForeignKeyComponent.
9 10 11 12 13 14 |
# File 'lib/annotate_rb/model_annotator/foreign_key_annotation/foreign_key_component.rb', line 9 def initialize(formatted_name, constraints_info, ref_info, max_size) @formatted_name = formatted_name @constraints_info = constraints_info @ref_info = ref_info @max_size = max_size end |
Instance Attribute Details
#constraints_info ⇒ Object (readonly)
Returns the value of attribute constraints_info.
7 8 9 |
# File 'lib/annotate_rb/model_annotator/foreign_key_annotation/foreign_key_component.rb', line 7 def constraints_info @constraints_info end |
#formatted_name ⇒ Object (readonly)
Returns the value of attribute formatted_name.
7 8 9 |
# File 'lib/annotate_rb/model_annotator/foreign_key_annotation/foreign_key_component.rb', line 7 def formatted_name @formatted_name end |
#max_size ⇒ Object (readonly)
Returns the value of attribute max_size.
7 8 9 |
# File 'lib/annotate_rb/model_annotator/foreign_key_annotation/foreign_key_component.rb', line 7 def max_size @max_size end |
#ref_info ⇒ Object (readonly)
Returns the value of attribute ref_info.
7 8 9 |
# File 'lib/annotate_rb/model_annotator/foreign_key_annotation/foreign_key_component.rb', line 7 def ref_info @ref_info end |
Instance Method Details
#to_default ⇒ Object
23 24 25 26 27 28 29 30 |
# File 'lib/annotate_rb/model_annotator/foreign_key_annotation/foreign_key_component.rb', line 23 def to_default # standard:disable Lint/FormatParameterMismatch format("# %-#{max_size}.#{max_size}s %s %s", formatted_name, "(#{ref_info})", constraints_info).rstrip # standard:enable Lint/FormatParameterMismatch end |
#to_markdown ⇒ Object
16 17 18 19 20 21 |
# File 'lib/annotate_rb/model_annotator/foreign_key_annotation/foreign_key_component.rb', line 16 def to_markdown format("# * `%s`%s:\n# * **`%s`**", formatted_name, constraints_info.blank? ? "" : " (_#{constraints_info}_)", ref_info) end |