Class: AnnotateRb::ModelAnnotator::EnumAnnotation::EnumComponent
- Inherits:
-
Components::Base
- Object
- Components::Base
- AnnotateRb::ModelAnnotator::EnumAnnotation::EnumComponent
- Defined in:
- lib/annotate_rb/model_annotator/enum_annotation/enum_component.rb
Instance Attribute Summary collapse
-
#max_size ⇒ Object
readonly
Returns the value of attribute max_size.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#values ⇒ Object
readonly
Returns the value of attribute values.
Instance Method Summary collapse
-
#initialize(name, values, max_size) ⇒ EnumComponent
constructor
A new instance of EnumComponent.
- #to_default ⇒ Object
- #to_markdown ⇒ Object
Methods inherited from Components::Base
Constructor Details
#initialize(name, values, max_size) ⇒ EnumComponent
Returns a new instance of EnumComponent.
9 10 11 12 13 |
# File 'lib/annotate_rb/model_annotator/enum_annotation/enum_component.rb', line 9 def initialize(name, values, max_size) @name = name @values = values @max_size = max_size end |
Instance Attribute Details
#max_size ⇒ Object (readonly)
Returns the value of attribute max_size.
7 8 9 |
# File 'lib/annotate_rb/model_annotator/enum_annotation/enum_component.rb', line 7 def max_size @max_size end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
7 8 9 |
# File 'lib/annotate_rb/model_annotator/enum_annotation/enum_component.rb', line 7 def name @name end |
#values ⇒ Object (readonly)
Returns the value of attribute values.
7 8 9 |
# File 'lib/annotate_rb/model_annotator/enum_annotation/enum_component.rb', line 7 def values @values end |
Instance Method Details
#to_default ⇒ Object
15 16 17 18 19 |
# File 'lib/annotate_rb/model_annotator/enum_annotation/enum_component.rb', line 15 def to_default # standard:disable Lint/FormatParameterMismatch sprintf("# %-#{max_size}.#{max_size}s %s", name, values.join(", ")).rstrip # standard:enable Lint/FormatParameterMismatch end |
#to_markdown ⇒ Object
21 22 23 |
# File 'lib/annotate_rb/model_annotator/enum_annotation/enum_component.rb', line 21 def to_markdown sprintf("# * `%s`: `%s`", name, values.join(", ")) end |